public class Lua51Natives extends Object implements party.iroiro.luajava.LuaNatives
This file is programmatically generated from the Lua 5.1 Reference Manual.
The following functions are excluded:
luaL_addcharluaL_addlstringluaL_addsizeluaL_addstringluaL_addvalueluaL_argcheckluaL_argerrorluaL_buffinitluaL_checkanyluaL_checkintluaL_checkintegerluaL_checklongluaL_checklstringluaL_checknumberluaL_checkoptionluaL_checkstackluaL_checkstringluaL_checktypeluaL_checkudataluaL_dofileluaL_errorluaL_loadbufferluaL_loadfileluaL_optintluaL_optintegerluaL_optlongluaL_optlstringluaL_optnumberluaL_optstringluaL_prepbufferluaL_pushresultluaL_registerlua_atpaniclua_calllua_cpcalllua_dumplua_getallocflua_gethooklua_getinfolua_getlocallua_getstacklua_loadlua_newstatelua_pushcclosurelua_pushcfunctionlua_pushfstringlua_pushliterallua_pushlstringlua_pushvfstringlua_registerlua_setallocflua_sethooklua_setlocallua_tocfunctionlua_tolstring| Modifier | Constructor and Description |
|---|---|
protected |
Lua51Natives() |
| Modifier and Type | Method and Description |
|---|---|
int |
getRegistryIndex()
Get
LUA_REGISTRYINDEX, which is a computed compile time constant |
void |
loadAsGlobal()
Exposes the symbols in the natives to external libraries.
|
int |
lua_checkstack(long ptr,
int extra)
Wrapper of
lua_checkstack |
void |
lua_close(long ptr)
Wrapper of
lua_close |
void |
lua_concat(long ptr,
int n)
Wrapper of
lua_concat |
void |
lua_createtable(long ptr,
int narr,
int nrec)
Wrapper of
lua_createtable |
int |
lua_equal(long ptr,
int index1,
int index2)
Wrapper of
lua_equal |
int |
lua_error(long ptr)
Wrapper of
lua_error |
int |
lua_gc(long ptr,
int what,
int data)
Wrapper of
lua_gc |
void |
lua_getfenv(long ptr,
int index)
Wrapper of
lua_getfenv |
void |
lua_getfield(long ptr,
int index,
String k)
Wrapper of
lua_getfield |
void |
lua_getglobal(long ptr,
String name)
Wrapper of
lua_getglobal |
int |
lua_gethookcount(long ptr)
Wrapper of
lua_gethookcount |
int |
lua_gethookmask(long ptr)
Wrapper of
lua_gethookmask |
int |
lua_getmetatable(long ptr,
int index)
Wrapper of
lua_getmetatable |
void |
lua_gettable(long ptr,
int index)
Wrapper of
lua_gettable |
int |
lua_gettop(long ptr)
Wrapper of
lua_gettop |
String |
lua_getupvalue(long ptr,
int funcindex,
int n)
Wrapper of
lua_getupvalue |
void |
lua_insert(long ptr,
int index)
Wrapper of
lua_insert |
int |
lua_isboolean(long ptr,
int index)
Wrapper of
lua_isboolean |
int |
lua_iscfunction(long ptr,
int index)
Wrapper of
lua_iscfunction |
int |
lua_isfunction(long ptr,
int index)
Wrapper of
lua_isfunction |
int |
lua_islightuserdata(long ptr,
int index)
Wrapper of
lua_islightuserdata |
int |
lua_isnil(long ptr,
int index)
Wrapper of
lua_isnil |
int |
lua_isnone(long ptr,
int index)
Wrapper of
lua_isnone |
int |
lua_isnoneornil(long ptr,
int index)
Wrapper of
lua_isnoneornil |
int |
lua_isnumber(long ptr,
int index)
Wrapper of
lua_isnumber |
int |
lua_isstring(long ptr,
int index)
Wrapper of
lua_isstring |
int |
lua_istable(long ptr,
int index)
Wrapper of
lua_istable |
int |
lua_isthread(long ptr,
int index)
Wrapper of
lua_isthread |
int |
lua_isuserdata(long ptr,
int index)
Wrapper of
lua_isuserdata |
int |
lua_lessthan(long ptr,
int index1,
int index2)
Wrapper of
lua_lessthan |
void |
lua_newtable(long ptr)
Wrapper of
lua_newtable |
long |
lua_newthread(long ptr)
Wrapper of
lua_newthread |
long |
lua_newuserdata(long ptr,
long size)
Wrapper of
lua_newuserdata |
int |
lua_next(long ptr,
int index)
Wrapper of
lua_next |
long |
lua_objlen(long ptr,
int index)
Wrapper of
lua_objlen |
int |
lua_pcall(long ptr,
int nargs,
int nresults,
int errfunc)
Wrapper of
lua_pcall |
void |
lua_pop(long ptr,
int n)
Wrapper of
lua_pop |
void |
lua_pushboolean(long ptr,
int b)
Wrapper of
lua_pushboolean |
void |
lua_pushinteger(long ptr,
long n)
Wrapper of
lua_pushinteger |
void |
lua_pushlightuserdata(long ptr,
long p)
Wrapper of
lua_pushlightuserdata |
void |
lua_pushnil(long ptr)
Wrapper of
lua_pushnil |
void |
lua_pushnumber(long ptr,
double n)
Wrapper of
lua_pushnumber |
void |
lua_pushstring(long ptr,
String s)
Wrapper of
lua_pushstring |
int |
lua_pushthread(long ptr)
Wrapper of
lua_pushthread |
void |
lua_pushvalue(long ptr,
int index)
Wrapper of
lua_pushvalue |
int |
lua_rawequal(long ptr,
int index1,
int index2)
Wrapper of
lua_rawequal |
void |
lua_rawget(long ptr,
int index)
Wrapper of
lua_rawget |
void |
lua_rawgeti(long ptr,
int index,
int n)
Wrapper of
lua_rawgeti |
void |
lua_rawset(long ptr,
int index)
Wrapper of
lua_rawset |
void |
lua_rawseti(long ptr,
int index,
int n)
Wrapper of
lua_rawseti |
void |
lua_remove(long ptr,
int index)
Wrapper of
lua_remove |
void |
lua_replace(long ptr,
int index)
Wrapper of
lua_replace |
int |
lua_resume(long ptr,
int narg)
Wrapper of
lua_resume |
int |
lua_setfenv(long ptr,
int index)
Wrapper of
lua_setfenv |
void |
lua_setfield(long ptr,
int index,
String k)
Wrapper of
lua_setfield |
void |
lua_setglobal(long ptr,
String name)
Wrapper of
lua_setglobal |
int |
lua_setmetatable(long ptr,
int index)
Wrapper of
lua_setmetatable |
void |
lua_settable(long ptr,
int index)
Wrapper of
lua_settable |
void |
lua_settop(long ptr,
int index)
Wrapper of
lua_settop |
String |
lua_setupvalue(long ptr,
int funcindex,
int n)
Wrapper of
lua_setupvalue |
int |
lua_status(long ptr)
Wrapper of
lua_status |
int |
lua_toboolean(long ptr,
int index)
Wrapper of
lua_toboolean |
long |
lua_tointeger(long ptr,
int index)
Wrapper of
lua_tointeger |
double |
lua_tonumber(long ptr,
int index)
Wrapper of
lua_tonumber |
long |
lua_topointer(long ptr,
int index)
Wrapper of
lua_topointer |
String |
lua_tostring(long ptr,
int index)
Wrapper of
lua_tostring |
long |
lua_tothread(long ptr,
int index)
Wrapper of
lua_tothread |
long |
lua_touserdata(long ptr,
int index)
Wrapper of
lua_touserdata |
int |
lua_type(long ptr,
int index)
Wrapper of
lua_type |
String |
lua_typename(long ptr,
int tp)
Wrapper of
lua_typename |
void |
lua_xmove(long from,
long to,
int n)
Wrapper of
lua_xmove |
int |
lua_yield(long ptr,
int nresults)
Wrapper of
lua_yield |
int |
luaJ_compare(long ptr,
int index1,
int index2,
int op)
A wrapper function
|
int |
luaJ_dobuffer(long ptr,
Buffer buffer,
int size,
String name)
A wrapper function
|
Object |
luaJ_dumptobuffer(long ptr)
A wrapper function
|
void |
luaJ_gc(long ptr)
A wrapper function
|
void |
luaJ_getfield(long ptr,
int index,
String k)
Wrapper of
lua_getfield |
void |
luaJ_getglobal(long ptr,
String name)
Wrapper of
lua_getglobal |
void |
luaJ_getmetatable(long ptr,
String tname)
Wrapper of
luaL_getmetatable |
void |
luaJ_gettable(long ptr,
int index)
Wrapper of
lua_gettable |
int |
luaJ_initloader(long ptr)
A wrapper function
|
int |
luaJ_invokespecial(long ptr,
Class clazz,
String method,
String sig,
Object obj,
String params)
A wrapper function
|
int |
luaJ_isinteger(long ptr,
int index)
A wrapper function
|
int |
luaJ_isobject(long ptr,
int index)
A wrapper function
|
int |
luaJ_len(long ptr,
int index)
A wrapper function
|
int |
luaJ_loadbuffer(long ptr,
Buffer buffer,
int size,
String name)
A wrapper function
|
long |
luaJ_newthread(long ptr,
int lid)
A wrapper function
|
void |
luaJ_openlib(long ptr,
String lib)
A wrapper function
|
void |
luaJ_pusharray(long ptr,
Object array)
A wrapper function
|
void |
luaJ_pushclass(long ptr,
Object clazz)
A wrapper function
|
void |
luaJ_pushfunction(long ptr,
Object func)
A wrapper function
|
void |
luaJ_pushobject(long ptr,
Object obj)
A wrapper function
|
void |
luaJ_pushstring(long ptr,
String s)
Wrapper of
lua_pushstring |
void |
luaJ_rawget(long ptr,
int index)
Wrapper of
lua_rawget |
void |
luaJ_rawgeti(long ptr,
int index,
int n)
Wrapper of
lua_rawgeti |
void |
luaJ_removestateindex(long ptr)
A wrapper function
|
int |
luaJ_resume(long ptr,
int nargs)
A wrapper function
|
void |
luaJ_setmetatable(long ptr,
int index)
Wrapper of
lua_setmetatable |
Object |
luaJ_tobuffer(long ptr,
int index)
A wrapper function
|
Object |
luaJ_todirectbuffer(long ptr,
int index)
A wrapper function
|
Object |
luaJ_toobject(long ptr,
int index)
A wrapper function
|
int |
luaL_callmeta(long ptr,
int obj,
String e)
Wrapper of
luaL_callmeta |
int |
luaL_dostring(long ptr,
String str)
Wrapper of
luaL_dostring |
int |
luaL_getmetafield(long ptr,
int obj,
String e)
Wrapper of
luaL_getmetafield |
void |
luaL_getmetatable(long ptr,
String tname)
Wrapper of
luaL_getmetatable |
String |
luaL_gsub(long ptr,
String s,
String p,
String r)
Wrapper of
luaL_gsub |
int |
luaL_loadstring(long ptr,
String s)
Wrapper of
luaL_loadstring |
int |
luaL_newmetatable(long ptr,
String tname)
Wrapper of
luaL_newmetatable |
long |
luaL_newstate(int lid)
Wrapper of
luaL_newstate |
void |
luaL_openlibs(long ptr)
Wrapper of
luaL_openlibs |
int |
luaL_ref(long ptr,
int t)
Wrapper of
luaL_ref |
String |
luaL_typename(long ptr,
int index)
Wrapper of
luaL_typename |
int |
luaL_typerror(long ptr,
int narg,
String tname)
Wrapper of
luaL_typerror |
void |
luaL_unref(long ptr,
int t,
int ref)
Wrapper of
luaL_unref |
void |
luaL_where(long ptr,
int lvl)
Wrapper of
luaL_where |
protected Lua51Natives()
throws IllegalStateException
IllegalStateExceptionpublic void loadAsGlobal()
Users are only allowed load one instance of natives if they want it global. Otherwise, the JVM might just crash due to identical symbol names in different binaries.
loadAsGlobal in interface party.iroiro.luajava.LuaNativespublic int getRegistryIndex()
LUA_REGISTRYINDEX, which is a computed compile time constantgetRegistryIndex in interface party.iroiro.luajava.LuaNativespublic int lua_checkstack(long ptr,
int extra)
lua_checkstack
[-0, +0, m]
int lua_checkstack (lua_State *L, int extra);
Ensures that there are at least extra free stack slots in the stack.
It returns false if it cannot grow the stack to that size.
This function never shrinks the stack;
if the stack is already larger than the new size,
it is left unchanged.
lua_checkstack in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerextra - extra slotspublic void lua_close(long ptr)
lua_close
[-0, +0, -]
void lua_close (lua_State *L);
Destroys all objects in the given Lua state (calling the corresponding garbage-collection metamethods, if any) and frees all dynamic memory used by this state. On several platforms, you may not need to call this function, because all resources are naturally released when the host program ends. On the other hand, long-running programs, such as a daemon or a web server, might need to release states as soon as they are not needed, to avoid growing too large.
lua_close in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerpublic void lua_concat(long ptr,
int n)
lua_concat
[-n, +1, e]
void lua_concat (lua_State *L, int n);
Concatenates the n values at the top of the stack,
pops them, and leaves the result at the top.
If n is 1, the result is the single value on the stack
(that is, the function does nothing);
if n is 0, the result is the empty string.
Concatenation is performed following the usual semantics of Lua
(see §2.5.4).
lua_concat in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointern - the number of elementspublic void lua_createtable(long ptr,
int narr,
int nrec)
lua_createtable
[-0, +1, m]
void lua_createtable (lua_State *L, int narr, int nrec);
Creates a new empty table and pushes it onto the stack.
The new table has space pre-allocated
for narr array elements and nrec non-array elements.
This pre-allocation is useful when you know exactly how many elements
the table will have.
Otherwise you can use the function lua_newtable.
lua_createtable in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointernarr - the number of pre-allocated array elementsnrec - the number of pre-allocated non-array elementspublic int lua_equal(long ptr,
int index1,
int index2)
lua_equal
[-0, +0, e]
int lua_equal (lua_State *L, int index1, int index2);
Returns 1 if the two values in acceptable indices index1 and
index2 are equal,
following the semantics of the Lua == operator
(that is, may call metamethods).
Otherwise returns 0.
Also returns 0 if any of the indices is non valid.
ptr - the lua_State* pointerindex1 - the stack position of the first elementindex2 - the stack position of the second elementpublic int lua_error(long ptr)
lua_error
[-1, +0, v]
int lua_error (lua_State *L);
Generates a Lua error.
The error message (which can actually be a Lua value of any type)
must be on the stack top.
This function does a long jump,
and therefore never returns.
(see luaL_error).
lua_error in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerpublic int lua_gc(long ptr,
int what,
int data)
lua_gc
[-0, +0, e]
int lua_gc (lua_State *L, int what, int data);
Controls the garbage collector.
This function performs several tasks,
according to the value of the parameter what:
LUA_GCSTOP:
stops the garbage collector.
LUA_GCRESTART:
restarts the garbage collector.
LUA_GCCOLLECT:
performs a full garbage-collection cycle.
LUA_GCCOUNT:
returns the current amount of memory (in Kbytes) in use by Lua.
LUA_GCCOUNTB:
returns the remainder of dividing the current amount of bytes of
memory in use by Lua by 1024.
LUA_GCSTEP:
performs an incremental step of garbage collection.
The step "size" is controlled by data
(larger values mean more steps) in a non-specified way.
If you want to control the step size
you must experimentally tune the value of data.
The function returns 1 if the step finished a
garbage-collection cycle.
LUA_GCSETPAUSE:
sets data as the new value
for the pause of the collector (see §2.10).
The function returns the previous value of the pause.
LUA_GCSETSTEPMUL:
sets data as the new value for the step multiplier of
the collector (see §2.10).
The function returns the previous value of the step multiplier.
ptr - the lua_State* pointerwhat - whatdata - datapublic void lua_getfenv(long ptr,
int index)
lua_getfenv
[-0, +1, -]
void lua_getfenv (lua_State *L, int index);
Pushes onto the stack the environment table of the value at the given index.
ptr - the lua_State* pointerindex - the stack position of the elementpublic void lua_getfield(long ptr,
int index,
String k)
lua_getfield
[-0, +1, e]
void lua_getfield (lua_State *L, int index, const char *k);
Pushes onto the stack the value t[k],
where t is the value at the given valid index.
As in Lua, this function may trigger a metamethod
for the "index" event (see §2.8).
ptr - the lua_State* pointerindex - the stack position of the elementk - the field namepublic void luaJ_getfield(long ptr,
int index,
String k)
lua_getfield
[-0, +1, e]
void lua_getfield (lua_State *L, int index, const char *k);
Pushes onto the stack the value t[k],
where t is the value at the given valid index.
As in Lua, this function may trigger a metamethod
for the "index" event (see §2.8).
luaJ_getfield in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementk - the field namepublic void lua_getglobal(long ptr,
String name)
lua_getglobal
[-0, +1, e]
void lua_getglobal (lua_State *L, const char *name);
Pushes onto the stack the value of the global name.
It is defined as a macro:
#define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, s)
ptr - the lua_State* pointername - the namepublic void luaJ_getglobal(long ptr,
String name)
lua_getglobal
[-0, +1, e]
void lua_getglobal (lua_State *L, const char *name);
Pushes onto the stack the value of the global name.
It is defined as a macro:
#define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, s)
luaJ_getglobal in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointername - the namepublic int lua_getmetatable(long ptr,
int index)
lua_getmetatable
[-0, +(0|1), -]
int lua_getmetatable (lua_State *L, int index);
Pushes onto the stack the metatable of the value at the given acceptable index. If the index is not valid, or if the value does not have a metatable, the function returns 0 and pushes nothing on the stack.
lua_getmetatable in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic void lua_gettable(long ptr,
int index)
lua_gettable
[-1, +1, e]
void lua_gettable (lua_State *L, int index);
Pushes onto the stack the value t[k],
where t is the value at the given valid index
and k is the value at the top of the stack.
This function pops the key from the stack (putting the resulting value in its place). As in Lua, this function may trigger a metamethod for the "index" event (see §2.8).
ptr - the lua_State* pointerindex - the stack position of the elementpublic void luaJ_gettable(long ptr,
int index)
lua_gettable
[-1, +1, e]
void lua_gettable (lua_State *L, int index);
Pushes onto the stack the value t[k],
where t is the value at the given valid index
and k is the value at the top of the stack.
This function pops the key from the stack (putting the resulting value in its place). As in Lua, this function may trigger a metamethod for the "index" event (see §2.8).
luaJ_gettable in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic int lua_gettop(long ptr)
lua_gettop
[-0, +0, -]
int lua_gettop (lua_State *L);
Returns the index of the top element in the stack. Because indices start at 1, this result is equal to the number of elements in the stack (and so 0 means an empty stack).
lua_gettop in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerpublic void lua_insert(long ptr,
int index)
lua_insert
[-1, +1, -]
void lua_insert (lua_State *L, int index);
Moves the top element into the given valid index, shifting up the elements above this index to open space. Cannot be called with a pseudo-index, because a pseudo-index is not an actual stack position.
lua_insert in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic int lua_isboolean(long ptr,
int index)
lua_isboolean
[-0, +0, -]
int lua_isboolean (lua_State *L, int index);
Returns 1 if the value at the given acceptable index has type boolean, and 0 otherwise.
lua_isboolean in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic int lua_iscfunction(long ptr,
int index)
lua_iscfunction
[-0, +0, -]
int lua_iscfunction (lua_State *L, int index);
Returns 1 if the value at the given acceptable index is a C function, and 0 otherwise.
lua_iscfunction in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic int lua_isfunction(long ptr,
int index)
lua_isfunction
[-0, +0, -]
int lua_isfunction (lua_State *L, int index);
Returns 1 if the value at the given acceptable index is a function (either C or Lua), and 0 otherwise.
lua_isfunction in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic int lua_islightuserdata(long ptr,
int index)
lua_islightuserdata
[-0, +0, -]
int lua_islightuserdata (lua_State *L, int index);
Returns 1 if the value at the given acceptable index is a light userdata, and 0 otherwise.
lua_islightuserdata in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic int lua_isnil(long ptr,
int index)
lua_isnil
[-0, +0, -]
int lua_isnil (lua_State *L, int index);
Returns 1 if the value at the given acceptable index is nil, and 0 otherwise.
lua_isnil in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic int lua_isnone(long ptr,
int index)
lua_isnone
[-0, +0, -]
int lua_isnone (lua_State *L, int index);
Returns 1 if the given acceptable index is not valid (that is, it refers to an element outside the current stack), and 0 otherwise.
lua_isnone in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic int lua_isnoneornil(long ptr,
int index)
lua_isnoneornil
[-0, +0, -]
int lua_isnoneornil (lua_State *L, int index);
Returns 1 if the given acceptable index is not valid (that is, it refers to an element outside the current stack) or if the value at this index is nil, and 0 otherwise.
lua_isnoneornil in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic int lua_isnumber(long ptr,
int index)
lua_isnumber
[-0, +0, -]
int lua_isnumber (lua_State *L, int index);
Returns 1 if the value at the given acceptable index is a number or a string convertible to a number, and 0 otherwise.
lua_isnumber in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic int lua_isstring(long ptr,
int index)
lua_isstring
[-0, +0, -]
int lua_isstring (lua_State *L, int index);
Returns 1 if the value at the given acceptable index is a string or a number (which is always convertible to a string), and 0 otherwise.
lua_isstring in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic int lua_istable(long ptr,
int index)
lua_istable
[-0, +0, -]
int lua_istable (lua_State *L, int index);
Returns 1 if the value at the given acceptable index is a table, and 0 otherwise.
lua_istable in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic int lua_isthread(long ptr,
int index)
lua_isthread
[-0, +0, -]
int lua_isthread (lua_State *L, int index);
Returns 1 if the value at the given acceptable index is a thread, and 0 otherwise.
lua_isthread in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic int lua_isuserdata(long ptr,
int index)
lua_isuserdata
[-0, +0, -]
int lua_isuserdata (lua_State *L, int index);
Returns 1 if the value at the given acceptable index is a userdata (either full or light), and 0 otherwise.
lua_isuserdata in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic int lua_lessthan(long ptr,
int index1,
int index2)
lua_lessthan
[-0, +0, e]
int lua_lessthan (lua_State *L, int index1, int index2);
Returns 1 if the value at acceptable index index1 is smaller
than the value at acceptable index index2,
following the semantics of the Lua < operator
(that is, may call metamethods).
Otherwise returns 0.
Also returns 0 if any of the indices is non valid.
ptr - the lua_State* pointerindex1 - the stack position of the first elementindex2 - the stack position of the second elementpublic void lua_newtable(long ptr)
lua_newtable
[-0, +1, m]
void lua_newtable (lua_State *L);
Creates a new empty table and pushes it onto the stack.
It is equivalent to lua_createtable(L, 0, 0).
lua_newtable in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerpublic long lua_newthread(long ptr)
lua_newthread
[-0, +1, m]
lua_State *lua_newthread (lua_State *L);
Creates a new thread, pushes it on the stack,
and returns a pointer to a lua_State that represents this new thread.
The new state returned by this function shares with the original state
all global objects (such as tables),
but has an independent execution stack.
There is no explicit function to close or to destroy a thread. Threads are subject to garbage collection, like any Lua object.
lua_newthread in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerpublic long lua_newuserdata(long ptr,
long size)
lua_newuserdata
[-0, +1, m]
void *lua_newuserdata (lua_State *L, size_t size);
This function allocates a new block of memory with the given size, pushes onto the stack a new full userdata with the block address, and returns this address.
Userdata represent C values in Lua. A full userdata represents a block of memory. It is an object (like a table): you must create it, it can have its own metatable, and you can detect when it is being collected. A full userdata is only equal to itself (under raw equality).
When Lua collects a full userdata with a gc metamethod,
Lua calls the metamethod and marks the userdata as finalized.
When this userdata is collected again then
Lua frees its corresponding memory.
ptr - the lua_State* pointersize - sizepublic int lua_next(long ptr,
int index)
lua_next
[-1, +(2|0), e]
int lua_next (lua_State *L, int index);
Pops a key from the stack,
and pushes a key-value pair from the table at the given index
(the "next" pair after the given key).
If there are no more elements in the table,
then lua_next returns 0 (and pushes nothing).
A typical traversal looks like this:
/* table is in the stack at index 't' */
lua_pushnil(L); /* first key */
while (lua_next(L, t) != 0) {
/* uses 'key' (at index -2) and 'value' (at index -1) */
printf("%s - %s\n",
lua_typename(L, lua_type(L, -2)),
lua_typename(L, lua_type(L, -1)));
/* removes 'value'; keeps 'key' for next iteration */
lua_pop(L, 1);
}
While traversing a table,
do not call lua_tolstring directly on a key,
unless you know that the key is actually a string.
Recall that lua_tolstring changes
the value at the given index;
this confuses the next call to lua_next.
lua_next in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic long lua_objlen(long ptr,
int index)
lua_objlen
[-0, +0, -]
size_t lua_objlen (lua_State *L, int index);
Returns the "length" of the value at the given acceptable index:
for strings, this is the string length;
for tables, this is the result of the length operator ('#');
for userdata, this is the size of the block of memory allocated
for the userdata;
for other values, it is 0.
ptr - the lua_State* pointerindex - the stack position of the elementpublic int lua_pcall(long ptr,
int nargs,
int nresults,
int errfunc)
lua_pcall
[-(nargs + 1), +(nresults|1), -]
int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc);
Calls a function in protected mode.
Both nargs and nresults have the same meaning as
in lua_call.
If there are no errors during the call,
lua_pcall behaves exactly like lua_call.
However, if there is any error,
lua_pcall catches it,
pushes a single value on the stack (the error message),
and returns an error code.
Like lua_call,
lua_pcall always removes the function
and its arguments from the stack.
If errfunc is 0,
then the error message returned on the stack
is exactly the original error message.
Otherwise, errfunc is the stack index of an
error handler function.
(In the current implementation, this index cannot be a pseudo-index.)
In case of runtime errors,
this function will be called with the error message
and its return value will be the message returned on the stack by lua_pcall.
Typically, the error handler function is used to add more debug
information to the error message, such as a stack traceback.
Such information cannot be gathered after the return of lua_pcall,
since by then the stack has unwound.
The lua_pcall function returns 0 in case of success
or one of the following error codes
(defined in lua.h):
LUA_ERRRUN:
a runtime error.
LUA_ERRMEM:
memory allocation error.
For such errors, Lua does not call the error handler function.
LUA_ERRERR:
error while running the error handler function.
lua_pcall in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointernargs - the number of arguments that you pushed onto the stacknresults - the number of results, or LUA_MULTRETerrfunc - 0 or the stack index of an error handler functionpublic void lua_pop(long ptr,
int n)
lua_pop in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointern - the number of elementspublic void lua_pushboolean(long ptr,
int b)
lua_pushboolean
[-0, +1, -]
void lua_pushboolean (lua_State *L, int b);
Pushes a boolean value with value b onto the stack.
lua_pushboolean in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerb - booleanpublic void lua_pushinteger(long ptr,
long n)
lua_pushinteger
[-0, +1, -]
void lua_pushinteger (lua_State *L, lua_Integer n);
Pushes a number with value n onto the stack.
lua_pushinteger in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointern - the number / the number of elementspublic void lua_pushlightuserdata(long ptr,
long p)
lua_pushlightuserdata
[-0, +1, -]
void lua_pushlightuserdata (lua_State *L, void *p);
Pushes a light userdata onto the stack.
Userdata represent C values in Lua. A light userdata represents a pointer. It is a value (like a number): you do not create it, it has no individual metatable, and it is not collected (as it was never created). A light userdata is equal to "any" light userdata with the same C address.
lua_pushlightuserdata in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerp - the pointerpublic void lua_pushnil(long ptr)
lua_pushnil
[-0, +1, -]
void lua_pushnil (lua_State *L);
Pushes a nil value onto the stack.
lua_pushnil in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerpublic void lua_pushnumber(long ptr,
double n)
lua_pushnumber
[-0, +1, -]
void lua_pushnumber (lua_State *L, lua_Number n);
Pushes a number with value n onto the stack.
lua_pushnumber in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointern - the number / the number of elementspublic void lua_pushstring(long ptr,
String s)
lua_pushstring
[-0, +1, m]
void lua_pushstring (lua_State *L, const char *s);
Pushes the zero-terminated string pointed to by s
onto the stack.
Lua makes (or reuses) an internal copy of the given string,
so the memory at s can be freed or reused immediately after
the function returns.
The string cannot contain embedded zeros;
it is assumed to end at the first zero.
ptr - the lua_State* pointers - the stringpublic void luaJ_pushstring(long ptr,
String s)
lua_pushstring
[-0, +1, m]
void lua_pushstring (lua_State *L, const char *s);
Pushes the zero-terminated string pointed to by s
onto the stack.
Lua makes (or reuses) an internal copy of the given string,
so the memory at s can be freed or reused immediately after
the function returns.
The string cannot contain embedded zeros;
it is assumed to end at the first zero.
luaJ_pushstring in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointers - the stringpublic int lua_pushthread(long ptr)
lua_pushthread
[-0, +1, -]
int lua_pushthread (lua_State *L);
Pushes the thread represented by L onto the stack.
Returns 1 if this thread is the main thread of its state.
lua_pushthread in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerpublic void lua_pushvalue(long ptr,
int index)
lua_pushvalue
[-0, +1, -]
void lua_pushvalue (lua_State *L, int index);
Pushes a copy of the element at the given valid index onto the stack.
lua_pushvalue in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic int lua_rawequal(long ptr,
int index1,
int index2)
lua_rawequal
[-0, +0, -]
int lua_rawequal (lua_State *L, int index1, int index2);
Returns 1 if the two values in acceptable indices index1 and
index2 are primitively equal
(that is, without calling metamethods).
Otherwise returns 0.
Also returns 0 if any of the indices are non valid.
lua_rawequal in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex1 - the stack position of the first elementindex2 - the stack position of the second elementpublic void lua_rawget(long ptr,
int index)
lua_rawget
[-1, +1, -]
void lua_rawget (lua_State *L, int index);
Similar to lua_gettable, but does a raw access
(i.e., without metamethods).
ptr - the lua_State* pointerindex - the stack position of the elementpublic void luaJ_rawget(long ptr,
int index)
lua_rawget
[-1, +1, -]
void lua_rawget (lua_State *L, int index);
Similar to lua_gettable, but does a raw access
(i.e., without metamethods).
luaJ_rawget in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic void lua_rawgeti(long ptr,
int index,
int n)
lua_rawgeti
[-0, +1, -]
void lua_rawgeti (lua_State *L, int index, int n);
Pushes onto the stack the value t[n],
where t is the value at the given valid index.
The access is raw;
that is, it does not invoke metamethods.
ptr - the lua_State* pointerindex - the stack position of the elementn - the number of elementspublic void luaJ_rawgeti(long ptr,
int index,
int n)
lua_rawgeti
[-0, +1, -]
void lua_rawgeti (lua_State *L, int index, int n);
Pushes onto the stack the value t[n],
where t is the value at the given valid index.
The access is raw;
that is, it does not invoke metamethods.
luaJ_rawgeti in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementn - the number of elementspublic void lua_rawset(long ptr,
int index)
lua_rawset
[-2, +0, m]
void lua_rawset (lua_State *L, int index);
Similar to lua_settable, but does a raw assignment
(i.e., without metamethods).
lua_rawset in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic void lua_rawseti(long ptr,
int index,
int n)
lua_rawseti
[-1, +0, m]
void lua_rawseti (lua_State *L, int index, int n);
Does the equivalent of t[n] = v,
where t is the value at the given valid index
and v is the value at the top of the stack.
This function pops the value from the stack. The assignment is raw; that is, it does not invoke metamethods.
lua_rawseti in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementn - the number of elementspublic void lua_remove(long ptr,
int index)
lua_remove
[-1, +0, -]
void lua_remove (lua_State *L, int index);
Removes the element at the given valid index, shifting down the elements above this index to fill the gap. Cannot be called with a pseudo-index, because a pseudo-index is not an actual stack position.
lua_remove in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic void lua_replace(long ptr,
int index)
lua_replace
[-1, +0, -]
void lua_replace (lua_State *L, int index);
Moves the top element into the given position (and pops it), without shifting any element (therefore replacing the value at the given position).
lua_replace in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic int lua_resume(long ptr,
int narg)
lua_resume
[-?, +?, -]
int lua_resume (lua_State *L, int narg);
Starts and resumes a coroutine in a given thread.
To start a coroutine, you first create a new thread
(see lua_newthread);
then you push onto its stack the main function plus any arguments;
then you call lua_resume,
with narg being the number of arguments.
This call returns when the coroutine suspends or finishes its execution.
When it returns, the stack contains all values passed to lua_yield,
or all values returned by the body function.
lua_resume returns
LUA_YIELD if the coroutine yields,
0 if the coroutine finishes its execution
without errors,
or an error code in case of errors (see lua_pcall).
In case of errors,
the stack is not unwound,
so you can use the debug API over it.
The error message is on the top of the stack.
To restart a coroutine, you put on its stack only the values to
be passed as results from yield,
and then call lua_resume.
ptr - the lua_State* pointernarg - the number of argumentspublic int lua_setfenv(long ptr,
int index)
lua_setfenv
[-1, +0, -]
int lua_setfenv (lua_State *L, int index);
Pops a table from the stack and sets it as
the new environment for the value at the given index.
If the value at the given index is
neither a function nor a thread nor a userdata,
lua_setfenv returns 0.
Otherwise it returns 1.
ptr - the lua_State* pointerindex - the stack position of the elementpublic void lua_setfield(long ptr,
int index,
String k)
lua_setfield
[-1, +0, e]
void lua_setfield (lua_State *L, int index, const char *k);
Does the equivalent to t[k] = v,
where t is the value at the given valid index
and v is the value at the top of the stack.
This function pops the value from the stack. As in Lua, this function may trigger a metamethod for the "newindex" event (see §2.8).
lua_setfield in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementk - the field namepublic void lua_setglobal(long ptr,
String name)
lua_setglobal
[-1, +0, e]
void lua_setglobal (lua_State *L, const char *name);
Pops a value from the stack and
sets it as the new value of global name.
It is defined as a macro:
#define lua_setglobal(L,s) lua_setfield(L, LUA_GLOBALSINDEX, s)
lua_setglobal in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointername - the namepublic int lua_setmetatable(long ptr,
int index)
lua_setmetatable
[-1, +0, -]
int lua_setmetatable (lua_State *L, int index);
Pops a table from the stack and sets it as the new metatable for the value at the given acceptable index.
ptr - the lua_State* pointerindex - the stack position of the elementpublic void luaJ_setmetatable(long ptr,
int index)
lua_setmetatable
[-1, +0, -]
int lua_setmetatable (lua_State *L, int index);
Pops a table from the stack and sets it as the new metatable for the value at the given acceptable index.
luaJ_setmetatable in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic void lua_settable(long ptr,
int index)
lua_settable
[-2, +0, e]
void lua_settable (lua_State *L, int index);
Does the equivalent to t[k] = v,
where t is the value at the given valid index,
v is the value at the top of the stack,
and k is the value just below the top.
This function pops both the key and the value from the stack. As in Lua, this function may trigger a metamethod for the "newindex" event (see §2.8).
lua_settable in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic void lua_settop(long ptr,
int index)
lua_settop
[-?, +?, -]
void lua_settop (lua_State *L, int index);
Accepts any acceptable index, or 0,
and sets the stack top to this index.
If the new top is larger than the old one,
then the new elements are filled with nil.
If index is 0, then all stack elements are removed.
lua_settop in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic int lua_status(long ptr)
lua_status
[-0, +0, -]
int lua_status (lua_State *L);
Returns the status of the thread L.
The status can be 0 for a normal thread,
an error code if the thread finished its execution with an error,
or LUA_YIELD if the thread is suspended.
lua_status in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerpublic int lua_toboolean(long ptr,
int index)
lua_toboolean
[-0, +0, -]
int lua_toboolean (lua_State *L, int index);
Converts the Lua value at the given acceptable index to a C boolean
value (0 or 1).
Like all tests in Lua,
lua_toboolean returns 1 for any Lua value
different from false and nil;
otherwise it returns 0.
It also returns 0 when called with a non-valid index.
(If you want to accept only actual boolean values,
use lua_isboolean to test the value's type.)
lua_toboolean in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic long lua_tointeger(long ptr,
int index)
lua_tointeger
[-0, +0, -]
lua_Integer lua_tointeger (lua_State *L, int index);
Converts the Lua value at the given acceptable index
to the signed integral type lua_Integer.
The Lua value must be a number or a string convertible to a number
(see §2.2.1);
otherwise, lua_tointeger returns 0.
If the number is not an integer, it is truncated in some non-specified way.
lua_tointeger in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic double lua_tonumber(long ptr,
int index)
lua_tonumber
[-0, +0, -]
lua_Number lua_tonumber (lua_State *L, int index);
Converts the Lua value at the given acceptable index
to the C type lua_Number (see lua_Number).
The Lua value must be a number or a string convertible to a number
(see §2.2.1);
otherwise, lua_tonumber returns 0.
lua_tonumber in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic long lua_topointer(long ptr,
int index)
lua_topointer
[-0, +0, -]
const void *lua_topointer (lua_State *L, int index);
Converts the value at the given acceptable index to a generic
C pointer (void*).
The value can be a userdata, a table, a thread, or a function;
otherwise, lua_topointer returns NULL.
Different objects will give different pointers.
There is no way to convert the pointer back to its original value.
Typically this function is used only for debug information.
lua_topointer in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic String lua_tostring(long ptr, int index)
lua_tostring
[-0, +0, m]
const char *lua_tostring (lua_State *L, int index);
Equivalent to lua_tolstring with len equal to NULL.
lua_tostring in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic long lua_tothread(long ptr,
int index)
lua_tothread
[-0, +0, -]
lua_State *lua_tothread (lua_State *L, int index);
Converts the value at the given acceptable index to a Lua thread
(represented as lua_State*).
This value must be a thread;
otherwise, the function returns NULL.
lua_tothread in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic long lua_touserdata(long ptr,
int index)
lua_touserdata
[-0, +0, -]
void *lua_touserdata (lua_State *L, int index);
If the value at the given acceptable index is a full userdata,
returns its block address.
If the value is a light userdata,
returns its pointer.
Otherwise, returns NULL.
lua_touserdata in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic int lua_type(long ptr,
int index)
lua_type
[-0, +0, -]
int lua_type (lua_State *L, int index);
Returns the type of the value in the given acceptable index,
or LUA_TNONE for a non-valid index
(that is, an index to an "empty" stack position).
The types returned by lua_type are coded by the following constants
defined in lua.h:
LUA_TNIL,
LUA_TNUMBER,
LUA_TBOOLEAN,
LUA_TSTRING,
LUA_TTABLE,
LUA_TFUNCTION,
LUA_TUSERDATA,
LUA_TTHREAD,
and
LUA_TLIGHTUSERDATA.
lua_type in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic String lua_typename(long ptr, int tp)
lua_typename
[-0, +0, -]
const char *lua_typename (lua_State *L, int tp);
Returns the name of the type encoded by the value tp,
which must be one the values returned by lua_type.
lua_typename in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointertp - type idpublic void lua_xmove(long from,
long to,
int n)
lua_xmove
[-?, +?, -]
void lua_xmove (lua_State *from, lua_State *to, int n);
Exchange values between different threads of the same global state.
This function pops n values from the stack from,
and pushes them onto the stack to.
lua_xmove in interface party.iroiro.luajava.LuaNativesfrom - a threadto - another threadn - the number of elementspublic int lua_yield(long ptr,
int nresults)
lua_yield
[-?, +?, -]
int lua_yield (lua_State *L, int nresults);
Yields a coroutine.
This function should only be called as the return expression of a C function, as follows:
return lua_yield (L, nresults);
When a C function calls lua_yield in that way,
the running coroutine suspends its execution,
and the call to lua_resume that started this coroutine returns.
The parameter nresults is the number of values from the stack
that are passed as results to lua_resume.
lua_yield in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointernresults - the number of results, or LUA_MULTRETpublic int lua_gethookcount(long ptr)
lua_gethookcount
[-0, +0, -]
int lua_gethookcount (lua_State *L);
Returns the current hook count.
lua_gethookcount in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerpublic int lua_gethookmask(long ptr)
lua_gethookmask
[-0, +0, -]
int lua_gethookmask (lua_State *L);
Returns the current hook mask.
lua_gethookmask in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerpublic String lua_getupvalue(long ptr, int funcindex, int n)
lua_getupvalue
[-0, +(0|1), -]
const char *lua_getupvalue (lua_State *L, int funcindex, int n);
Gets information about a closure's upvalue.
(For Lua functions,
upvalues are the external local variables that the function uses,
and that are consequently included in its closure.)
lua_getupvalue gets the index n of an upvalue,
pushes the upvalue's value onto the stack,
and returns its name.
funcindex points to the closure in the stack.
(Upvalues have no particular order,
as they are active through the whole function.
So, they are numbered in an arbitrary order.)
Returns NULL (and pushes nothing)
when the index is greater than the number of upvalues.
For C functions, this function uses the empty string ""
as a name for all upvalues.
lua_getupvalue in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerfuncindex - the stack position of the closuren - the index in the upvaluepublic String lua_setupvalue(long ptr, int funcindex, int n)
lua_setupvalue
[-(0|1), +0, -]
const char *lua_setupvalue (lua_State *L, int funcindex, int n);
Sets the value of a closure's upvalue.
It assigns the value at the top of the stack
to the upvalue and returns its name.
It also pops the value from the stack.
Parameters funcindex and n are as in the lua_getupvalue
(see lua_getupvalue).
Returns NULL (and pops nothing)
when the index is greater than the number of upvalues.
lua_setupvalue in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerfuncindex - the stack position of the closuren - the index in the upvaluepublic int luaL_callmeta(long ptr,
int obj,
String e)
luaL_callmeta
[-0, +(0|1), e]
int luaL_callmeta (lua_State *L, int obj, const char *e);
Calls a metamethod.
If the object at index obj has a metatable and this
metatable has a field e,
this function calls this field and passes the object as its only argument.
In this case this function returns 1 and pushes onto the
stack the value returned by the call.
If there is no metatable or no metamethod,
this function returns 0 (without pushing any value on the stack).
luaL_callmeta in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerobj - the stack position of the objecte - field namepublic int luaL_dostring(long ptr,
String str)
luaL_dostring
[-0, +?, m]
int luaL_dostring (lua_State *L, const char *str);
Loads and runs the given string. It is defined as the following macro:
(luaL_loadstring(L, str) || lua_pcall(L, 0, LUA_MULTRET, 0))
It returns 0 if there are no errors or 1 in case of errors.
luaL_dostring in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerstr - stringpublic int luaL_getmetafield(long ptr,
int obj,
String e)
luaL_getmetafield
[-0, +(0|1), m]
int luaL_getmetafield (lua_State *L, int obj, const char *e);
Pushes onto the stack the field e from the metatable
of the object at index obj.
If the object does not have a metatable,
or if the metatable does not have this field,
returns 0 and pushes nothing.
luaL_getmetafield in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerobj - the stack position of the objecte - field namepublic void luaL_getmetatable(long ptr,
String tname)
luaL_getmetatable
[-0, +1, -]
void luaL_getmetatable (lua_State *L, const char *tname);
Pushes onto the stack the metatable associated with name tname
in the registry (see luaL_newmetatable).
ptr - the lua_State* pointertname - type namepublic void luaJ_getmetatable(long ptr,
String tname)
luaL_getmetatable
[-0, +1, -]
void luaL_getmetatable (lua_State *L, const char *tname);
Pushes onto the stack the metatable associated with name tname
in the registry (see luaL_newmetatable).
luaJ_getmetatable in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointertname - type namepublic String luaL_gsub(long ptr, String s, String p, String r)
luaL_gsub
[-0, +1, m]
const char *luaL_gsub (lua_State *L,
const char *s,
const char *p,
const char *r);
Creates a copy of string s by replacing
any occurrence of the string p
with the string r.
Pushes the resulting string on the stack and returns it.
ptr - the lua_State* pointers - the stringp - the replaced sequencer - the replacing stringpublic int luaL_loadstring(long ptr,
String s)
luaL_loadstring
[-0, +1, m]
int luaL_loadstring (lua_State *L, const char *s);
Loads a string as a Lua chunk.
This function uses lua_load to load the chunk in
the zero-terminated string s.
This function returns the same results as lua_load.
Also as lua_load, this function only loads the chunk;
it does not run it.
luaL_loadstring in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointers - the stringpublic int luaL_newmetatable(long ptr,
String tname)
luaL_newmetatable
[-0, +1, m]
int luaL_newmetatable (lua_State *L, const char *tname);
If the registry already has the key tname,
returns 0.
Otherwise,
creates a new table to be used as a metatable for userdata,
adds it to the registry with key tname,
and returns 1.
In both cases pushes onto the stack the final value associated
with tname in the registry.
luaL_newmetatable in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointertname - type namepublic long luaL_newstate(int lid)
luaL_newstate
[-0, +0, -]
lua_State *luaL_newstate (void);
Creates a new Lua state.
It calls lua_newstate with an
allocator based on the standard C realloc function
and then sets a panic function (see lua_atpanic) that prints
an error message to the standard error output in case of fatal
errors.
Returns the new state,
or NULL if there is a memory allocation error.
luaL_newstate in interface party.iroiro.luajava.LuaNativeslid - the id of the Lua state, to be used to identify between Java and Luapublic void luaL_openlibs(long ptr)
luaL_openlibs
[-0, +0, m]
void luaL_openlibs (lua_State *L);
Opens all standard Lua libraries into the given state.
luaL_openlibs in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerpublic int luaL_ref(long ptr,
int t)
luaL_ref
[-1, +0, m]
int luaL_ref (lua_State *L, int t);
Creates and returns a reference,
in the table at index t,
for the object at the top of the stack (and pops the object).
A reference is a unique integer key.
As long as you do not manually add integer keys into table t,
luaL_ref ensures the uniqueness of the key it returns.
You can retrieve an object referred by reference r
by calling lua_rawgeti(L, t, r).
Function luaL_unref frees a reference and its associated object.
If the object at the top of the stack is nil,
luaL_ref returns the constant LUA_REFNIL.
The constant LUA_NOREF is guaranteed to be different
from any reference returned by luaL_ref.
luaL_ref in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointert - the stack indexpublic String luaL_typename(long ptr, int index)
luaL_typename
[-0, +0, -]
const char *luaL_typename (lua_State *L, int index);
Returns the name of the type of the value at the given index.
luaL_typename in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic int luaL_typerror(long ptr,
int narg,
String tname)
luaL_typerror
[-0, +0, v]
int luaL_typerror (lua_State *L, int narg, const char *tname);
Generates an error with a message like the following:
location: bad argument narg to 'func' (tname expected, got rt)
where location is produced by luaL_where,
func is the name of the current function,
and rt is the type name of the actual argument.
ptr - the lua_State* pointernarg - the number of argumentstname - type namepublic void luaL_unref(long ptr,
int t,
int ref)
luaL_unref
[-0, +0, -]
void luaL_unref (lua_State *L, int t, int ref);
Releases reference ref from the table at index t
(see luaL_ref).
The entry is removed from the table,
so that the referred object can be collected.
The reference ref is also freed to be used again.
If ref is LUA_NOREF or LUA_REFNIL,
luaL_unref does nothing.
luaL_unref in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointert - the stack indexref - the referencepublic void luaL_where(long ptr,
int lvl)
luaL_where
[-0, +1, m]
void luaL_where (lua_State *L, int lvl);
Pushes onto the stack a string identifying the current position
of the control at level lvl in the call stack.
Typically this string has the following format:
chunkname:currentline:
Level 0 is the running function, level 1 is the function that called the running function, etc.
This function is used to build a prefix for error messages.
luaL_where in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerlvl - the running levelpublic void luaJ_openlib(long ptr,
String lib)
Open a library indivisually, alternative to luaL_openlibs
luaJ_openlib in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerlib - library namepublic int luaJ_compare(long ptr,
int index1,
int index2,
int op)
See lua_compare
luaJ_compare in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex1 - the stack position of the first elementindex2 - the stack position of the second elementop - the operatorpublic int luaJ_len(long ptr,
int index)
Wrapper of lua_(obj)len
luaJ_len in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic int luaJ_loadbuffer(long ptr,
Buffer buffer,
int size,
String name)
Load a direct buffer
luaJ_loadbuffer in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerbuffer - the buffer (expecting direct)size - sizename - the namepublic int luaJ_dobuffer(long ptr,
Buffer buffer,
int size,
String name)
Run a direct buffer
luaJ_dobuffer in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerbuffer - the buffer (expecting direct)size - sizename - the namepublic int luaJ_resume(long ptr,
int nargs)
Resume a coroutine
luaJ_resume in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointernargs - the number of arguments that you pushed onto the stackpublic void luaJ_pushobject(long ptr,
Object obj)
Push a Java object
luaJ_pushobject in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerobj - the Java objectpublic void luaJ_pushclass(long ptr,
Object clazz)
Push a Java class
luaJ_pushclass in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerclazz - the Java classpublic void luaJ_pusharray(long ptr,
Object array)
Push a Java array
luaJ_pusharray in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerarray - the Java arraypublic void luaJ_pushfunction(long ptr,
Object func)
Push a JFunction
luaJ_pushfunction in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerfunc - the function objectpublic int luaJ_isobject(long ptr,
int index)
Is a Java object (including object, array or class)
luaJ_isobject in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic Object luaJ_toobject(long ptr, int index)
Convert to Java object if it is one
luaJ_toobject in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic long luaJ_newthread(long ptr,
int lid)
Create a new thread
luaJ_newthread in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerlid - the id of the Lua state, to be used to identify between Java and Luapublic int luaJ_initloader(long ptr)
Append a searcher loading from Java side into package.searchers / loaders
luaJ_initloader in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerpublic int luaJ_invokespecial(long ptr,
Class clazz,
String method,
String sig,
Object obj,
String params)
Runs CallNonvirtual<type>MethodA. See AbstractLua for usages.
Parameters should be boxed and pushed on stack.
luaJ_invokespecial in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerclazz - the Java classmethod - the method namesig - the method signature used in GetMethodIDobj - the Java objectparams - encoded parameter typespublic int luaJ_isinteger(long ptr,
int index)
See lua_isinteger
luaJ_isinteger in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic void luaJ_removestateindex(long ptr)
Removes the thread from the global registry, thus allowing it to get garbage collected
luaJ_removestateindex in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerpublic void luaJ_gc(long ptr)
Performs a full garbage-collection cycle
luaJ_gc in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerpublic Object luaJ_dumptobuffer(long ptr)
See lua_dump
luaJ_dumptobuffer in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerpublic Object luaJ_tobuffer(long ptr, int index)
See lua_tolstring
luaJ_tobuffer in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the elementpublic Object luaJ_todirectbuffer(long ptr, int index)
See lua_tolstring
luaJ_todirectbuffer in interface party.iroiro.luajava.LuaNativesptr - the lua_State* pointerindex - the stack position of the element