|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.keplerproject.luajava.JavaFunction
public abstract class JavaFunction
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)
.
Constructor Summary | |
---|---|
JavaFunction(LuaState L)
Constructor that receives a LuaState. |
Method Summary | |
---|---|
abstract int |
execute()
This method is called from Lua. |
LuaObject |
getParam(int idx)
Returns a parameter received from Lua. |
void |
register(java.lang.String name)
Register a JavaFunction with a given name. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JavaFunction(LuaState L)
L
- LuaState object associated with this JavaFunction objectMethod Detail |
---|
public abstract int execute() throws LuaException
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.
LuaException
public LuaObject getParam(int idx)
this
).
idx
- Index of the parameter.
LuaObject
public void register(java.lang.String name) throws LuaException
name
- name of the function.
LuaException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |