| |
|
| java.lang.Object org.keplerproject.luajava.JavaFunction
JavaFunction | abstract public class JavaFunction (Code) | | JavaFunction is a class that can be used to implement a Lua function in Java.
JavaFunction is an abstract class, so in order to use it you must extend this
class and implement the execute method. This execute
method is the method that will be called when you call the function from Lua.
To register the JavaFunction in Lua use the method register(String name) .
|
Field Summary | |
protected LuaState | L This is the state in which this function will exist. |
Method Summary | |
abstract public int | execute() This method is called from Lua. | public LuaObject | getParam(int idx) Returns a parameter received from Lua. | public void | register(String name) Register a JavaFunction with a given name. |
L | protected LuaState L(Code) | | This is the state in which this function will exist.
|
JavaFunction | public JavaFunction(LuaState L)(Code) | | Constructor that receives a LuaState.
Parameters: L - LuaState object associated with this JavaFunction object |
execute | abstract public int execute() throws LuaException(Code) | | This method is called from Lua. Any parameters can be taken with
getParam . A reference to the JavaFunctionWrapper itself is
always the first parameter received. Values passed back as results
of the function must be pushed onto the stack.
The number of values pushed onto the stack. |
getParam | public LuaObject getParam(int idx)(Code) | | Returns a parameter received from Lua. Parameters are numbered from 1.
A reference to the JavaFunction itself is always the first parameter
received (the same as this ).
Parameters: idx - Index of the parameter. Reference to parameter. See Also: LuaObject |
register | public void register(String name) throws LuaException(Code) | | Register a JavaFunction with a given name. This method registers in a
global variable the JavaFunction specified.
Parameters: name - name of the function. |
|
|
|