Package party.iroiro.luajava.value
Interface LuaThread
- All Known Subinterfaces:
Lua
public interface LuaThread
-
Method Summary
Modifier and TypeMethodDescriptionLuaValue[]Executes Lua codefrom(boolean b) Creates a boolean Lua value from a Java boolean.from(double n) Creates a number Lua value from a Java double.from(long n) Creates a number Lua value from a Java long.Creates a string Lua value from a Java string.from(ByteBuffer buffer) Creates a raw string Lua value from a byte buffer.fromNull()Creates a nil Lua value.Gets a references to a global objectvoidregister(String name, LuaFunction function) Registers the function to a global nameLoads a module, similar to the Lua `require` functionvoidSets a global variable to the given value
-
Method Details
-
set
Sets a global variable to the given value- Parameters:
key- the global variable namevalue- the value
-
get
Gets a references to a global object- Parameters:
globalName- the global name- Returns:
- a reference to the value
-
register
Registers the function to a global name- Parameters:
name- the global namefunction- the function
-
eval
Executes Lua code- Parameters:
command- the command- Returns:
- the return values
- Throws:
LuaException
-
require
Loads a module, similar to the Lua `require` functionPlease note that this method will attempt to call
Lua.openLibrary("package")first and cache the globalrequirefunction.- Parameters:
module- the module name- Returns:
- the module
- Throws:
LuaException
-
fromNull
LuaValue fromNull()Creates a nil Lua value.- Returns:
- a nil Lua value
-
from
Creates a boolean Lua value from a Java boolean.- Parameters:
b- the boolean- Returns:
- a boolean Lua value
-
from
Creates a number Lua value from a Java double.- Parameters:
n- the number- Returns:
- a number Lua value
-
from
Creates a number Lua value from a Java long.- Parameters:
n- the number- Returns:
- a number Lua value
-
from
Creates a string Lua value from a Java string.- Parameters:
s- the string- Returns:
- a string Lua value
-
from
Creates a raw string Lua value from a byte buffer.- Parameters:
buffer- the content of the raw string- Returns:
- a raw string Lua value
-