| java.lang.Object org.keplerproject.luajava.LuaState
LuaState | public class LuaState (Code) | | LuaState if the main class of LuaJava for the Java developer.
LuaState is a mapping of most of Lua's C API functions.
LuaState also provides many other functions that will be used to manipulate
objects between Lua and Java.
author: Thiago Ponte |
Method Summary | |
public int | LargError(int numArg, String extraMsg) | public int | LcallMeta(int obj, String e) | public void | LcheckAny(int nArg) | public int | LcheckInteger(int numArg) | public double | LcheckNumber(int numArg) | public void | LcheckStack(int sz, String msg) | public String | LcheckString(int numArg) | public void | LcheckType(int nArg, int t) | public int | LdoFile(String fileName) | public int | LdoString(String str) | public String | LfindTable(int idx, String fname, int szhint) | public int | LgetMetaField(int obj, String e) | public void | LgetMetatable(String tName) | public int | LgetN(int t) | public String | Lgsub(String s, String p, String r) | public int | LloadBuffer(byte[] buff, String name) | public int | LloadFile(String fileName) | public int | LloadString(String s) | public int | LnewMetatable(String tName) | public int | LoptInteger(int numArg, int def) | public double | LoptNumber(int numArg, double def) | public String | LoptString(int numArg, String def) | public int | Lref(int t) | public void | LsetN(int t, int n) | public int | Ltyperror(int nArg, String tName) | public void | LunRef(int t, int ref) | public void | Lwhere(int lvl) | public void | call(int nArgs, int nResults) | public int | checkStack(int sz) | public synchronized void | close() | public void | concat(int n) | public static Number | convertLuaNumber(Double db, Class retType) | public void | createTable(int narr, int nrec) | public int | equal(int idx1, int idx2) | public int | error() | public int | gc(int what, int data) | public long | getCPtrPeer() | public void | getFEnv(int idx) | public void | getField(int idx, String k) | public int | getGcCount() | public synchronized void | getGlobal(String global) | public LuaObject | getLuaObject(String globalName) | public LuaObject | getLuaObject(LuaObject parent, String name) | public LuaObject | getLuaObject(LuaObject parent, Number name) This constructor creates a LuaObject from a table that is indexed by a number. | public LuaObject | getLuaObject(LuaObject parent, LuaObject name) This constructor creates a LuaObject from a table that is indexed by any LuaObject. | public LuaObject | getLuaObject(int index) | public int | getMetaTable(int idx) | public Object | getObjectFromUserdata(int idx) | public void | getTable(int idx) | public int | getTop() | public void | insert(int idx) | public boolean | isBoolean(int idx) | public boolean | isCFunction(int idx) | public synchronized boolean | isClosed() Returns true if state is closed. | public boolean | isFunction(int idx) | public boolean | isJavaFunction(int idx) | public boolean | isNil(int idx) | public boolean | isNone(int idx) | public boolean | isNoneOrNil(int idx) | public boolean | isNumber(int idx) | public boolean | isObject(int idx) | public boolean | isString(int idx) | public boolean | isTable(int idx) | public boolean | isThread(int idx) | public boolean | isUserdata(int idx) | public int | lessthan(int idx1, int idx2) | public void | newTable() | public LuaState | newThread() | public int | next(int idx) | public int | objLen(int idx) | public void | openBase() | public void | openDebug() | public void | openIo() | public void | openLibs() | public void | openMath() | public void | openOs() | public void | openPackage() | public void | openString() | public void | openTable() | public int | pcall(int nArgs, int nResults, int errFunc) | public void | pop(int n) | public void | pushBoolean(boolean bool) | public void | pushInteger(int integer) | public void | pushJavaFunction(JavaFunction func) | public void | pushJavaObject(Object obj) Pushes a Java Object into the lua stack.
This function does not check if the object is from a class that could
be represented by a lua type. | public void | pushNil() | public void | pushNumber(double db) | public void | pushObjectValue(Object obj) Pushes into the stack any object value.
This function checks if the object could be pushed as a lua type, if not
pushes the java object. | public void | pushString(String str) | public void | pushString(byte[] bytes) | public void | pushValue(int idx) | public void | rawGet(int idx) | public void | rawGetI(int idx, int n) | public void | rawSet(int idx) | public void | rawSetI(int idx, int n) | public int | rawequal(int idx1, int idx2) | public void | remove(int idx) | public void | replace(int idx) | public int | resume(int nArgs) | public int | setFEnv(int idx) | public void | setField(int idx, String k) | public synchronized void | setGlobal(String name) | public int | setMetaTable(int idx) | public void | setTable(int idx) | public void | setTop(int idx) | public int | status() | public int | strLen(int idx) | public boolean | toBoolean(int idx) | public int | toInteger(int idx) | public synchronized Object | toJavaObject(int idx) Function that returns a Java Object equivalent to the one in the given
position of the Lua Stack. | public double | toNumber(int idx) | public String | toString(int idx) | public LuaState | toThread(int idx) | public int | type(int idx) | public String | typeName(int tp) | public void | xmove(LuaState to, int n) | public int | yield(int nResults) |
LUA_ERRERR | final public static Integer LUA_ERRERR(Code) | | error while running the error handler function.
|
LUA_ERRMEM | final public static Integer LUA_ERRMEM(Code) | | memory allocation error. For such errors, Lua does not call
the error handler function.
|
LUA_ERRRUN | final public static Integer LUA_ERRRUN(Code) | | a runtime error.
|
LUA_ERRSYNTAX | final public static Integer LUA_ERRSYNTAX(Code) | | syntax error during pre-compilation.
|
LUA_GCSETSTEPMUL | final public static Integer LUA_GCSETSTEPMUL(Code) | | |
LUA_GLOBALSINDEX | final public static Integer LUA_GLOBALSINDEX(Code) | | |
LUA_MULTRET | final public static Integer LUA_MULTRET(Code) | | Specifies that an unspecified (multiple) number of return arguments
will be returned by a call.
|
LUA_REGISTRYINDEX | final public static Integer LUA_REGISTRYINDEX(Code) | | |
LUA_TLIGHTUSERDATA | final public static Integer LUA_TLIGHTUSERDATA(Code) | | |
LuaState | protected LuaState(int stateId)(Code) | | Constructor to instance a new LuaState and initialize it with LuaJava's functions
Parameters: stateId - |
LuaState | protected LuaState(CPtr luaState)(Code) | | Receives a existing state and initializes it
Parameters: luaState - |
LargError | public int LargError(int numArg, String extraMsg)(Code) | | |
LcheckAny | public void LcheckAny(int nArg)(Code) | | |
LcheckInteger | public int LcheckInteger(int numArg)(Code) | | |
LcheckNumber | public double LcheckNumber(int numArg)(Code) | | |
LcheckStack | public void LcheckStack(int sz, String msg)(Code) | | |
LcheckType | public void LcheckType(int nArg, int t)(Code) | | |
LgetMetaField | public int LgetMetaField(int obj, String e)(Code) | | |
LgetN | public int LgetN(int t)(Code) | | |
LloadBuffer | public int LloadBuffer(byte[] buff, String name)(Code) | | |
LoptInteger | public int LoptInteger(int numArg, int def)(Code) | | |
LoptNumber | public double LoptNumber(int numArg, double def)(Code) | | |
Lref | public int Lref(int t)(Code) | | |
LsetN | public void LsetN(int t, int n)(Code) | | |
LunRef | public void LunRef(int t, int ref)(Code) | | |
Lwhere | public void Lwhere(int lvl)(Code) | | |
call | public void call(int nArgs, int nResults)(Code) | | |
checkStack | public int checkStack(int sz)(Code) | | |
close | public synchronized void close()(Code) | | Closes state and removes the object from the LuaStateFactory
|
concat | public void concat(int n)(Code) | | |
convertLuaNumber | public static Number convertLuaNumber(Double db, Class retType)(Code) | | When you call a function in lua, it may return a number, and the
number will be interpreted as a Double .
This function converts the number into a type specified by
retType
Parameters: db - lua number to be converted Parameters: retType - type to convert to The converted number |
createTable | public void createTable(int narr, int nrec)(Code) | | |
equal | public int equal(int idx1, int idx2)(Code) | | |
gc | public int gc(int what, int data)(Code) | | |
getCPtrPeer | public long getCPtrPeer()(Code) | | Return the long representing the LuaState pointer
long |
getFEnv | public void getFEnv(int idx)(Code) | | |
getGcCount | public int getGcCount()(Code) | | |
getGlobal | public synchronized void getGlobal(String global)(Code) | | |
getLuaObject | public LuaObject getLuaObject(String globalName)(Code) | | Creates a reference to an object in the variable globalName
Parameters: globalName - LuaObject |
getLuaObject | public LuaObject getLuaObject(LuaObject parent, String name) throws LuaException(Code) | | Creates a reference to an object inside another object
Parameters: parent - The Lua Table or Userdata that contains the Field. Parameters: name - The name that index the field LuaObject throws: LuaException - if parent is not a table or userdata |
getLuaObject | public LuaObject getLuaObject(LuaObject parent, Number name) throws LuaException(Code) | | This constructor creates a LuaObject from a table that is indexed by a number.
Parameters: parent - The Lua Table or Userdata that contains the Field. Parameters: name - The name (number) that index the field LuaObject throws: LuaException - When the parent object isn't a Table or Userdata |
getLuaObject | public LuaObject getLuaObject(LuaObject parent, LuaObject name) throws LuaException(Code) | | This constructor creates a LuaObject from a table that is indexed by any LuaObject.
Parameters: parent - The Lua Table or Userdata that contains the Field. Parameters: name - The name (LuaObject) that index the field LuaObject throws: LuaException - When the parent object isn't a Table or Userdata |
getLuaObject | public LuaObject getLuaObject(int index)(Code) | | Creates a reference to an object in the index position
of the stack
Parameters: index - position on the stack LuaObject |
getMetaTable | public int getMetaTable(int idx)(Code) | | |
getObjectFromUserdata | public Object getObjectFromUserdata(int idx) throws LuaException(Code) | | Gets a Object from Lua
Parameters: idx - index of the lua stack Object throws: LuaException - if the lua object does not represent a java object. |
getTable | public void getTable(int idx)(Code) | | |
getTop | public int getTop()(Code) | | |
insert | public void insert(int idx)(Code) | | |
isBoolean | public boolean isBoolean(int idx)(Code) | | |
isCFunction | public boolean isCFunction(int idx)(Code) | | |
isClosed | public synchronized boolean isClosed()(Code) | | Returns true if state is closed.
|
isFunction | public boolean isFunction(int idx)(Code) | | |
isJavaFunction | public boolean isJavaFunction(int idx)(Code) | | Returns whether a userdata contains a Java Function
Parameters: idx - index of the lua stack boolean |
isNil | public boolean isNil(int idx)(Code) | | |
isNone | public boolean isNone(int idx)(Code) | | |
isNoneOrNil | public boolean isNoneOrNil(int idx)(Code) | | |
isNumber | public boolean isNumber(int idx)(Code) | | |
isObject | public boolean isObject(int idx)(Code) | | Tells whether a lua index contains a java Object
Parameters: idx - index of the lua stack boolean |
isString | public boolean isString(int idx)(Code) | | |
isTable | public boolean isTable(int idx)(Code) | | |
isThread | public boolean isThread(int idx)(Code) | | |
isUserdata | public boolean isUserdata(int idx)(Code) | | |
lessthan | public int lessthan(int idx1, int idx2)(Code) | | |
newTable | public void newTable()(Code) | | |
next | public int next(int idx)(Code) | | |
objLen | public int objLen(int idx)(Code) | | |
openBase | public void openBase()(Code) | | |
openDebug | public void openDebug()(Code) | | |
openIo | public void openIo()(Code) | | |
openLibs | public void openLibs()(Code) | | |
openMath | public void openMath()(Code) | | |
openOs | public void openOs()(Code) | | |
openPackage | public void openPackage()(Code) | | |
openString | public void openString()(Code) | | |
openTable | public void openTable()(Code) | | |
pcall | public int pcall(int nArgs, int nResults, int errFunc)(Code) | | |
pop | public void pop(int n)(Code) | | |
pushBoolean | public void pushBoolean(boolean bool)(Code) | | |
pushInteger | public void pushInteger(int integer)(Code) | | |
pushJavaFunction | public void pushJavaFunction(JavaFunction func) throws LuaException(Code) | | Pushes a JavaFunction into the state stack
Parameters: func - |
pushJavaObject | public void pushJavaObject(Object obj)(Code) | | Pushes a Java Object into the lua stack.
This function does not check if the object is from a class that could
be represented by a lua type. Eg: java.lang.String could be a lua string.
Parameters: obj - Object to be pushed into lua |
pushNil | public void pushNil()(Code) | | |
pushNumber | public void pushNumber(double db)(Code) | | |
pushObjectValue | public void pushObjectValue(Object obj) throws LuaException(Code) | | Pushes into the stack any object value.
This function checks if the object could be pushed as a lua type, if not
pushes the java object.
Parameters: obj - |
pushString | public void pushString(byte[] bytes)(Code) | | |
pushValue | public void pushValue(int idx)(Code) | | |
rawGet | public void rawGet(int idx)(Code) | | |
rawGetI | public void rawGetI(int idx, int n)(Code) | | |
rawSet | public void rawSet(int idx)(Code) | | |
rawSetI | public void rawSetI(int idx, int n)(Code) | | |
rawequal | public int rawequal(int idx1, int idx2)(Code) | | |
remove | public void remove(int idx)(Code) | | |
replace | public void replace(int idx)(Code) | | |
resume | public int resume(int nArgs)(Code) | | |
setFEnv | public int setFEnv(int idx)(Code) | | |
setGlobal | public synchronized void setGlobal(String name)(Code) | | |
setMetaTable | public int setMetaTable(int idx)(Code) | | |
setTable | public void setTable(int idx)(Code) | | |
setTop | public void setTop(int idx)(Code) | | |
status | public int status()(Code) | | |
strLen | public int strLen(int idx)(Code) | | |
toBoolean | public boolean toBoolean(int idx)(Code) | | |
toInteger | public int toInteger(int idx)(Code) | | |
toJavaObject | public synchronized Object toJavaObject(int idx) throws LuaException(Code) | | Function that returns a Java Object equivalent to the one in the given
position of the Lua Stack.
Parameters: idx - Index in the Lua Stack Java object equivalent to the Lua one |
toNumber | public double toNumber(int idx)(Code) | | |
type | public int type(int idx)(Code) | | |
yield | public int yield(int nResults)(Code) | | |
|
|