|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.keplerproject.luajava.LuaState
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.
| Field Summary | |
static java.lang.Integer |
LUA_ERRERR
error while running the error handler function. |
static java.lang.Integer |
LUA_ERRFILE
|
static java.lang.Integer |
LUA_ERRMEM
memory allocation error. |
static java.lang.Integer |
LUA_ERRRUN
a runtime error. |
static java.lang.Integer |
LUA_ERRSYNTAX
syntax error during pre-compilation. |
static java.lang.Integer |
LUA_GLOBALSINDEX
|
static java.lang.Integer |
LUA_REGISTRYINDEX
|
static java.lang.Integer |
LUA_TBOOLEAN
|
static java.lang.Integer |
LUA_TFUNCTION
|
static java.lang.Integer |
LUA_TNIL
|
static java.lang.Integer |
LUA_TNUMBER
|
static java.lang.Integer |
LUA_TSTRING
|
static java.lang.Integer |
LUA_TTABLE
|
static java.lang.Integer |
LUA_TTHREAD
|
static java.lang.Integer |
LUA_TUSERDATA
|
| Method Summary | |
void |
call(int nArgs,
int nResults)
|
int |
checkStack(int sz)
|
void |
close()
Closes state and removes the object from the LuaStateFactory |
void |
concat(int n)
|
static java.lang.Number |
convertLuaNumber(java.lang.Double db,
java.lang.Class retType)
When you call a function in lua, it may return a number, and the number will be interpreted as a Double. |
int |
doBuffer(byte[] buff,
java.lang.String name)
|
int |
doFile(java.lang.String fileName)
|
int |
doString(java.lang.String str)
|
int |
equal(int idx1,
int idx2)
|
int |
error()
|
long |
getCPtrPeer()
Return the long representing the LuaState pointer |
void |
getFEnv(int idx)
|
int |
getGcCount()
|
int |
getGcThreshold()
|
void |
getGlobal(java.lang.String global)
|
LuaObject |
getLuaObject(int index)
Creates a reference to an object in the index position
of the stack |
LuaObject |
getLuaObject(LuaObject parent,
LuaObject name)
This constructor creates a LuaObject from a table that is indexed by any LuaObject. |
LuaObject |
getLuaObject(LuaObject parent,
java.lang.Number name)
This constructor creates a LuaObject from a table that is indexed by a number. |
LuaObject |
getLuaObject(LuaObject parent,
java.lang.String name)
Creates a reference to an object inside another object |
LuaObject |
getLuaObject(java.lang.String globalName)
Creates a reference to an object in the variable globalName |
int |
getMetaTable(int idx)
|
java.lang.Object |
getObjectFromUserdata(int idx)
Gets a Object from Lua |
void |
getTable(int idx)
|
int |
getTop()
|
void |
insert(int idx)
|
boolean |
isBoolean(int idx)
|
boolean |
isCFunction(int idx)
|
boolean |
isClosed()
Returns true if state is closed. |
boolean |
isFunction(int idx)
|
boolean |
isJavaFunction(int idx)
Returns whether a userdata contains a Java Function |
boolean |
isNil(int idx)
|
boolean |
isNumber(int idx)
|
boolean |
isObject(int idx)
Tells whether a lua index contains a java Object |
boolean |
isString(int idx)
|
boolean |
isTable(int idx)
|
boolean |
isUserdata(int idx)
|
int |
LargError(int numArg,
java.lang.String extraMsg)
|
int |
LcallMeta(int obj,
java.lang.String e)
|
void |
LcheckAny(int nArg)
|
double |
LcheckNumber(int numArg)
|
void |
LcheckStack(int sz,
java.lang.String msg)
|
java.lang.String |
LcheckString(int numArg)
|
void |
LcheckType(int nArg,
int t)
|
int |
lessthan(int idx1,
int idx2)
|
int |
LgetMetaField(int obj,
java.lang.String e)
|
void |
LgetMetatable(java.lang.String tName)
|
int |
LgetN(int t)
|
int |
LloadBuffer(byte[] buff,
java.lang.String name)
|
int |
LloadFile(java.lang.String fileName)
|
int |
LnewMetatable(java.lang.String tName)
|
double |
LoptNumber(int numArg,
double def)
|
java.lang.String |
LoptString(int numArg,
java.lang.String def)
|
int |
Lref(int t)
|
void |
LsetN(int t,
int n)
|
int |
Ltyperror(int nArg,
java.lang.String tName)
|
void |
LunRef(int t,
int ref)
|
void |
Lwhere(int lvl)
|
void |
newTable()
|
LuaState |
newThread()
|
int |
next(int idx)
|
void |
openBase()
|
void |
openBasicLibraries()
Open lua libraries, except for loadlib and debug |
void |
openDebug()
|
void |
openIo()
|
void |
openLoadLib()
|
void |
openMath()
|
void |
openString()
|
void |
openTable()
|
int |
pcall(int nArgs,
int nResults,
int errFunc)
|
void |
pop(int n)
|
void |
pushBoolean(int bool)
|
void |
pushJavaFunction(JavaFunction func)
Pushes a JavaFunction into the state stack |
void |
pushJavaObject(java.lang.Object obj)
Pushes a Java Object into the lua stack. |
void |
pushNil()
|
void |
pushNumber(double db)
|
void |
pushObjectValue(java.lang.Object obj)
Pushes into the stack any object value. |
void |
pushString(byte[] bytes)
|
void |
pushString(java.lang.String str)
|
void |
pushValue(int idx)
|
int |
rawequal(int idx1,
int idx2)
|
void |
rawGet(int idx)
|
void |
rawGetI(int idx,
int n)
|
void |
rawSet(int idx)
|
void |
rawSetI(int idx,
int n)
|
int |
ref(int t)
|
void |
remove(int idx)
|
void |
replace(int idx)
|
int |
resume(int nArgs)
|
int |
setFEnv(int idx)
|
void |
setGcThreshold(int newThreshold)
|
void |
setGlobal(java.lang.String name)
|
int |
setMetaTable(int idx)
|
void |
setTable(int idx)
|
void |
setTop(int idx)
|
int |
strLen(int idx)
|
boolean |
toBoolean(int idx)
|
java.lang.Object |
toJavaObject(int idx)
Function that returns a Java Object equivalent to the one in the given position of the Lua Stack. |
double |
toNumber(int idx)
|
java.lang.String |
toString(int idx)
|
LuaState |
toThread(int idx)
|
int |
type(int idx)
|
java.lang.String |
typeName(int tp)
|
void |
unRef(int t,
int ref)
|
java.lang.String |
version()
|
void |
xmove(LuaState to,
int n)
|
int |
yield(int nResults)
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.Integer LUA_GLOBALSINDEX
public static final java.lang.Integer LUA_REGISTRYINDEX
public static final java.lang.Integer LUA_TNIL
public static final java.lang.Integer LUA_TBOOLEAN
public static final java.lang.Integer LUA_TNUMBER
public static final java.lang.Integer LUA_TSTRING
public static final java.lang.Integer LUA_TTABLE
public static final java.lang.Integer LUA_TFUNCTION
public static final java.lang.Integer LUA_TUSERDATA
public static final java.lang.Integer LUA_TTHREAD
public static final java.lang.Integer LUA_ERRRUN
public static final java.lang.Integer LUA_ERRFILE
public static final java.lang.Integer LUA_ERRSYNTAX
public static final java.lang.Integer LUA_ERRMEM
public static final java.lang.Integer LUA_ERRERR
| Method Detail |
public void close()
public boolean isClosed()
true if state is closed.
public long getCPtrPeer()
public LuaState newThread()
public int getTop()
public void setTop(int idx)
public void pushValue(int idx)
public void remove(int idx)
public void insert(int idx)
public void replace(int idx)
public int checkStack(int sz)
public void xmove(LuaState to,
int n)
public boolean isNumber(int idx)
public boolean isString(int idx)
public boolean isFunction(int idx)
public boolean isCFunction(int idx)
public boolean isUserdata(int idx)
public boolean isTable(int idx)
public boolean isBoolean(int idx)
public int type(int idx)
public java.lang.String typeName(int tp)
public int equal(int idx1,
int idx2)
public int rawequal(int idx1,
int idx2)
public int lessthan(int idx1,
int idx2)
public double toNumber(int idx)
public boolean toBoolean(int idx)
public java.lang.String toString(int idx)
public int strLen(int idx)
public LuaState toThread(int idx)
public void pushNil()
public void pushNumber(double db)
public void pushString(java.lang.String str)
public void pushString(byte[] bytes)
public void pushBoolean(int bool)
public void getTable(int idx)
public void rawGet(int idx)
public void rawGetI(int idx,
int n)
public void newTable()
public int getMetaTable(int idx)
public void getFEnv(int idx)
public void setTable(int idx)
public void rawSet(int idx)
public void rawSetI(int idx,
int n)
public int setMetaTable(int idx)
public int setFEnv(int idx)
public void call(int nArgs,
int nResults)
public int pcall(int nArgs,
int nResults,
int errFunc)
public int yield(int nResults)
public int resume(int nArgs)
public int getGcThreshold()
public int getGcCount()
public void setGcThreshold(int newThreshold)
public java.lang.String version()
public int next(int idx)
public int error()
public void concat(int n)
public int ref(int t)
public void unRef(int t,
int ref)
public int doFile(java.lang.String fileName)
public int doString(java.lang.String str)
public int doBuffer(byte[] buff,
java.lang.String name)
public int LgetMetaField(int obj,
java.lang.String e)
public int LcallMeta(int obj,
java.lang.String e)
public int Ltyperror(int nArg,
java.lang.String tName)
public int LargError(int numArg,
java.lang.String extraMsg)
public java.lang.String LcheckString(int numArg)
public java.lang.String LoptString(int numArg,
java.lang.String def)
public double LcheckNumber(int numArg)
public double LoptNumber(int numArg,
double def)
public void LcheckStack(int sz,
java.lang.String msg)
public void LcheckType(int nArg,
int t)
public void LcheckAny(int nArg)
public int LnewMetatable(java.lang.String tName)
public void LgetMetatable(java.lang.String tName)
public void Lwhere(int lvl)
public int Lref(int t)
public void LunRef(int t,
int ref)
public int LgetN(int t)
public void LsetN(int t,
int n)
public int LloadFile(java.lang.String fileName)
public int LloadBuffer(byte[] buff,
java.lang.String name)
public void pop(int n)
public void getGlobal(java.lang.String global)
public void setGlobal(java.lang.String name)
public boolean isNil(int idx)
public void openBase()
public void openTable()
public void openIo()
public void openString()
public void openMath()
public void openDebug()
public void openLoadLib()
public void openBasicLibraries()
public java.lang.Object getObjectFromUserdata(int idx)
throws LuaException
idx - index of the lua stack
LuaException - if the lua object does not represent a java object.public boolean isObject(int idx)
idx - index of the lua stack
public void pushJavaObject(java.lang.Object obj)
obj - Object to be pushed into lua
public void pushJavaFunction(JavaFunction func)
throws LuaException
func -
LuaExceptionpublic boolean isJavaFunction(int idx)
idx - index of the lua stack
public void pushObjectValue(java.lang.Object obj)
throws LuaException
obj -
LuaException
public java.lang.Object toJavaObject(int idx)
throws LuaException
idx - Index in the Lua Stack
LuaExceptionpublic LuaObject getLuaObject(java.lang.String globalName)
globalName -
public LuaObject getLuaObject(LuaObject parent,
java.lang.String name)
throws LuaException
parent - The Lua Table or Userdata that contains the Field.name - The name that index the field
LuaException - if parent is not a table or userdata
public LuaObject getLuaObject(LuaObject parent,
java.lang.Number name)
throws LuaException
parent - The Lua Table or Userdata that contains the Field.name - The name (number) that index the field
LuaException - When the parent object isn't a Table or Userdata
public LuaObject getLuaObject(LuaObject parent,
LuaObject name)
throws LuaException
parent - The Lua Table or Userdata that contains the Field.name - The name (LuaObject) that index the field
LuaException - When the parent object isn't a Table or Userdatapublic LuaObject getLuaObject(int index)
index position
of the stack
index - position on the stack
public static java.lang.Number convertLuaNumber(java.lang.Double db,
java.lang.Class retType)
Double.retType
db - lua number to be convertedretType - type to convert to
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||