Class Lua55Natives

java.lang.Object
party.iroiro.luajava.lua55.Lua55Natives
All Implemented Interfaces:
LuaNatives

public class Lua55Natives extends Object implements LuaNatives
Lua C API wrappers

This file is programmatically generated from the Lua 5.5 Reference Manual.

The following functions are excluded:

  • luaL_addchar
  • luaL_addgsub
  • luaL_addlstring
  • luaL_addsize
  • luaL_addstring
  • luaL_addvalue
  • luaL_argcheck
  • luaL_argerror
  • luaL_argexpected
  • luaL_buffaddr
  • luaL_buffinit
  • luaL_buffinitsize
  • luaL_bufflen
  • luaL_buffsub
  • luaL_checkany
  • luaL_checkinteger
  • luaL_checklstring
  • luaL_checknumber
  • luaL_checkoption
  • luaL_checkstack
  • luaL_checkstring
  • luaL_checktype
  • luaL_checkudata
  • luaL_checkversion
  • luaL_dofile
  • luaL_error
  • luaL_loadbuffer
  • luaL_loadbufferx
  • luaL_loadfile
  • luaL_loadfilex
  • luaL_makeseed
  • luaL_newlib
  • luaL_newlibtable
  • luaL_openselectedlibs
  • luaL_opt
  • luaL_optinteger
  • luaL_optlstring
  • luaL_optnumber
  • luaL_optstring
  • luaL_prepbuffer
  • luaL_prepbuffsize
  • luaL_pushresult
  • luaL_pushresultsize
  • luaL_requiref
  • luaL_setfuncs
  • luaL_typeerror
  • lua_atpanic
  • lua_call
  • lua_callk
  • lua_dump
  • lua_gc
  • lua_getallocf
  • lua_gethook
  • lua_getinfo
  • lua_getlocal
  • lua_getstack
  • lua_load
  • lua_newstate
  • lua_numbertocstring
  • lua_pcallk
  • lua_pushcclosure
  • lua_pushcfunction
  • lua_pushexternalstring
  • lua_pushfstring
  • lua_pushliteral
  • lua_pushlstring
  • lua_pushvfstring
  • lua_register
  • lua_setallocf
  • lua_sethook
  • lua_setlocal
  • lua_setwarnf
  • lua_tocfunction
  • lua_tolstring
  • lua_yieldk
  • Constructor Details

  • Method Details

    • loadAsGlobal

      public void loadAsGlobal()
      Exposes the symbols in the natives to external libraries.

      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.

      Specified by:
      loadAsGlobal in interface LuaNatives
    • getRegistryIndex

      public int getRegistryIndex()
      Get LUA_REGISTRYINDEX, which is a computed compile time constant
      Specified by:
      getRegistryIndex in interface LuaNatives
      Returns:
      the LUA_REGISTRYINDEX constant, which changes between versions
    • lua_absindex

      public int lua_absindex(long ptr, int idx)
      Wrapper of lua_absindex
      
       [-0, +0, –]
       
      
       int lua_absindex (lua_State *L, int idx);
       

      Converts the acceptable index idx into an equivalent absolute index (that is, one that does not depend on the stack size).

      Parameters:
      ptr - the lua_State* pointer
      idx - the stack position
      Returns:
      see description
    • lua_arith

      public void lua_arith(long ptr, int op)
      Wrapper of lua_arith
      
       [-(2|1), +1, e]
       
      
       void lua_arith (lua_State *L, int op);
       

      Performs an arithmetic or bitwise operation over the two values (or one, in the case of negations) at the top of the stack, with the value on the top being the second operand, pops these values, and pushes the result of the operation. The function follows the semantics of the corresponding Lua operator (that is, it may call metamethods).

      The value of op must be one of the following constants:

      Parameters:
      ptr - the lua_State* pointer
      op - the operator
    • lua_checkstack

      public int lua_checkstack(long ptr, int n)
      Wrapper of lua_checkstack
      
       [-0, +0, –]
       
      
       int lua_checkstack (lua_State *L, int n);
       

      Ensures that the stack has space for at least n extra elements, that is, that you can safely push up to n values into it. It returns false if it cannot fulfill the request, either because it would cause the stack to be greater than a fixed maximum size (typically at least several thousand elements) or because it cannot allocate memory for the extra space. This function never shrinks the stack; if the stack already has space for the extra elements, it is left unchanged.

      Specified by:
      lua_checkstack in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      n - the number of elements
      Returns:
      see description
    • lua_close

      public void lua_close(long ptr)
      Wrapper of lua_close
      
       [-0, +0, –]
       
      
       void lua_close (lua_State *L);
       

      Close all active to-be-closed variables in the main thread, release 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 that create multiple states, such as daemons or web servers, will probably need to close states as soon as they are not needed.

      Specified by:
      lua_close in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
    • lua_closeslot

      public void lua_closeslot(long ptr, int index)
      Wrapper of lua_closeslot
      
       [-0, +0, e]
       
      
       void lua_closeslot (lua_State *L, int index);
       

      Close the to-be-closed slot at the given index and set its value to nil. The index must be the last index previously marked to be closed (see lua_toclose) that is still active (that is, not closed yet).

      A __close metamethod cannot yield when called through this function.

      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
    • lua_closethread

      public int lua_closethread(long ptr, long from)
      Wrapper of lua_closethread
      
       [-0, +?, –]
       
      
       int lua_closethread (lua_State *L, lua_State *from);
       

      Resets a thread, cleaning its call stack and closing all pending to-be-closed variables. The parameter from represents the coroutine that is resetting L. If there is no such coroutine, this parameter can be NULL.

      Unless L is equal to from, the call returns a status code: LUA_OK for no errors in the thread (either the original error that stopped the thread or errors in closing methods), or an error status otherwise. In case of error, the error object is put on the top of the stack.

      If L is equal to from, it corresponds to a thread closing itself. In that case, the call does not return; instead, the resume that (re)started the thread returns. The thread must be running inside a resume.

      Parameters:
      ptr - the lua_State* pointer
      from - a thread
      Returns:
      see description
    • lua_compare

      public int lua_compare(long ptr, int index1, int index2, int op)
      Wrapper of lua_compare
      
       [-0, +0, e]
       
      
       int lua_compare (lua_State *L, int index1, int index2, int op);
       

      Compares two Lua values. Returns 1 if the value at index index1 satisfies op when compared with the value at index index2, following the semantics of the corresponding Lua operator (that is, it may call metamethods). Otherwise returns 0. Also returns 0 if any of the indices is not valid.

      The value of op must be one of the following constants:

      Parameters:
      ptr - the lua_State* pointer
      index1 - the stack position of the first element
      index2 - the stack position of the second element
      op - the operator
      Returns:
      see description
    • lua_concat

      public void lua_concat(long ptr, int n)
      Wrapper of 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 on 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 §3.4.6).

      Specified by:
      lua_concat in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      n - the number of elements
    • lua_copy

      public void lua_copy(long ptr, int fromidx, int toidx)
      Wrapper of lua_copy
      
       [-0, +0, –]
       
      
       void lua_copy (lua_State *L, int fromidx, int toidx);
       

      Copies the element at index fromidx into the valid index toidx, replacing the value at that position. Values at other positions are not affected.

      Parameters:
      ptr - the lua_State* pointer
      fromidx - a stack position
      toidx - another stack position
    • lua_createtable

      public void lua_createtable(long ptr, int nseq, int nrec)
      Wrapper of lua_createtable
      
       [-0, +1, m]
       
      
       void lua_createtable (lua_State *L, int nseq, int nrec);
       

      Creates a new empty table and pushes it onto the stack. Parameter nseq is a hint for how many elements the table will have as a sequence; parameter nrec is a hint for how many other elements the table will have. Lua may use these hints to preallocate memory for the new table. This preallocation may help performance when you know in advance how many elements the table will have. Otherwise you should use the function lua_newtable.

      Specified by:
      lua_createtable in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      nseq - the number of pre-allocated array elements
      nrec - the number of pre-allocated non-array elements
    • lua_error

      public int lua_error(long ptr)
      Wrapper of lua_error
      
       [-1, +0, v]
       
      
       int lua_error (lua_State *L);
       

      Raises a Lua error, using the value on the top of the stack as the error object. This function does a long jump, and therefore never returns (see luaL_error).

      Specified by:
      lua_error in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      Returns:
      see description
    • lua_getfield

      public int lua_getfield(long ptr, int index, String k)
      Wrapper of lua_getfield
      
       [-0, +1, e]
       
      
       int 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 index. As in Lua, this function may trigger a metamethod for the "index" event (see §2.4).

      Returns the type of the pushed value.

      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      k - the field name
      Returns:
      see description
    • luaJ_getfield

      public void luaJ_getfield(long ptr, int index, String k)
      Wrapper of lua_getfield
      
       [-0, +1, e]
       
      
       int 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 index. As in Lua, this function may trigger a metamethod for the "index" event (see §2.4).

      Returns the type of the pushed value.

      Specified by:
      luaJ_getfield in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      k - the field name
    • lua_getextraspace

      public long lua_getextraspace(long ptr)
      Wrapper of lua_getextraspace
      
       [-0, +0, –]
       
      
       void *lua_getextraspace (lua_State *L);
       

      Returns a pointer to a raw memory area associated with the given Lua state. The application can use this area for any purpose; Lua does not use it for anything.

      Each new thread has this area initialized with a copy of the area of the main thread.

      By default, this area has the size of a pointer to void, but you can recompile Lua with a different size for this area. (See LUA_EXTRASPACE in luaconf.h.)

      Parameters:
      ptr - the lua_State* pointer
      Returns:
      see description
    • lua_getglobal

      public int lua_getglobal(long ptr, String name)
      Wrapper of lua_getglobal
      
       [-0, +1, e]
       
      
       int lua_getglobal (lua_State *L, const char *name);
       

      Pushes onto the stack the value of the global name. Returns the type of that value.

      Parameters:
      ptr - the lua_State* pointer
      name - the name
      Returns:
      see description
    • luaJ_getglobal

      public void luaJ_getglobal(long ptr, String name)
      Wrapper of lua_getglobal
      
       [-0, +1, e]
       
      
       int lua_getglobal (lua_State *L, const char *name);
       

      Pushes onto the stack the value of the global name. Returns the type of that value.

      Specified by:
      luaJ_getglobal in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      name - the name
    • lua_geti

      public int lua_geti(long ptr, int index, long i)
      Wrapper of lua_geti
      
       [-0, +1, e]
       
      
       int lua_geti (lua_State *L, int index, lua_Integer i);
       

      Pushes onto the stack the value t[i], where t is the value at the given index. As in Lua, this function may trigger a metamethod for the "index" event (see §2.4).

      Returns the type of the pushed value.

      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      i - i
      Returns:
      see description
    • luaJ_geti

      public void luaJ_geti(long ptr, int index, long i)
      Wrapper of lua_geti
      
       [-0, +1, e]
       
      
       int lua_geti (lua_State *L, int index, lua_Integer i);
       

      Pushes onto the stack the value t[i], where t is the value at the given index. As in Lua, this function may trigger a metamethod for the "index" event (see §2.4).

      Returns the type of the pushed value.

      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      i - i
    • lua_getmetatable

      public int lua_getmetatable(long ptr, int index)
      Wrapper of lua_getmetatable
      
       [-0, +(0|1), –]
       
      
       int lua_getmetatable (lua_State *L, int index);
       

      If the value at the given index has a metatable, the function pushes that metatable onto the stack and returns 1. Otherwise, the function returns 0 and pushes nothing on the stack.

      Specified by:
      lua_getmetatable in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • lua_gettable

      public int lua_gettable(long ptr, int index)
      Wrapper of lua_gettable
      
       [-1, +1, e]
       
      
       int lua_gettable (lua_State *L, int index);
       

      Pushes onto the stack the value t[k], where t is the value at the given index and k is the value on the top of the stack.

      This function pops the key from the stack, pushing the resulting value in its place. As in Lua, this function may trigger a metamethod for the "index" event (see §2.4).

      Returns the type of the pushed value.

      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • luaJ_gettable

      public void luaJ_gettable(long ptr, int index)
      Wrapper of lua_gettable
      
       [-1, +1, e]
       
      
       int lua_gettable (lua_State *L, int index);
       

      Pushes onto the stack the value t[k], where t is the value at the given index and k is the value on the top of the stack.

      This function pops the key from the stack, pushing the resulting value in its place. As in Lua, this function may trigger a metamethod for the "index" event (see §2.4).

      Returns the type of the pushed value.

      Specified by:
      luaJ_gettable in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
    • lua_gettop

      public int lua_gettop(long ptr)
      Wrapper of 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; in particular, 0 means an empty stack.

      Specified by:
      lua_gettop in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      Returns:
      see description
    • lua_getiuservalue

      public int lua_getiuservalue(long ptr, int index, int n)
      Wrapper of lua_getiuservalue
      
       [-0, +1, –]
       
      
       int lua_getiuservalue (lua_State *L, int index, int n);
       

      Pushes onto the stack the n-th user value associated with the full userdata at the given index and returns the type of the pushed value.

      If the userdata does not have that value, pushes nil and returns LUA_TNONE.

      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      n - the number of elements
      Returns:
      see description
    • lua_insert

      public void lua_insert(long ptr, int index)
      Wrapper of 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. This function cannot be called with a pseudo-index, because a pseudo-index is not an actual stack position.

      Specified by:
      lua_insert in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
    • lua_isboolean

      public int lua_isboolean(long ptr, int index)
      Wrapper of lua_isboolean
      
       [-0, +0, –]
       
      
       int lua_isboolean (lua_State *L, int index);
       

      Returns 1 if the value at the given index is a boolean, and 0 otherwise.

      Specified by:
      lua_isboolean in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • lua_iscfunction

      public int lua_iscfunction(long ptr, int index)
      Wrapper of lua_iscfunction
      
       [-0, +0, –]
       
      
       int lua_iscfunction (lua_State *L, int index);
       

      Returns 1 if the value at the given index is a C function, and 0 otherwise.

      Specified by:
      lua_iscfunction in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • lua_isfunction

      public int lua_isfunction(long ptr, int index)
      Wrapper of lua_isfunction
      
       [-0, +0, –]
       
      
       int lua_isfunction (lua_State *L, int index);
       

      Returns 1 if the value at the given index is a function (either C or Lua), and 0 otherwise.

      Specified by:
      lua_isfunction in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • lua_isinteger

      public int lua_isinteger(long ptr, int index)
      Wrapper of lua_isinteger
      
       [-0, +0, –]
       
      
       int lua_isinteger (lua_State *L, int index);
       

      Returns 1 if the value at the given index is an integer (that is, the value is a number and is represented as an integer), and 0 otherwise.

      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • lua_islightuserdata

      public int lua_islightuserdata(long ptr, int index)
      Wrapper of lua_islightuserdata
      
       [-0, +0, –]
       
      
       int lua_islightuserdata (lua_State *L, int index);
       

      Returns 1 if the value at the given index is a light userdata, and 0 otherwise.

      Specified by:
      lua_islightuserdata in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • lua_isnil

      public int lua_isnil(long ptr, int index)
      Wrapper of lua_isnil
      
       [-0, +0, –]
       
      
       int lua_isnil (lua_State *L, int index);
       

      Returns 1 if the value at the given index is nil, and 0 otherwise.

      Specified by:
      lua_isnil in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • lua_isnone

      public int lua_isnone(long ptr, int index)
      Wrapper of lua_isnone
      
       [-0, +0, –]
       
      
       int lua_isnone (lua_State *L, int index);
       

      Returns 1 if the given index is not valid, and 0 otherwise.

      Specified by:
      lua_isnone in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • lua_isnoneornil

      public int lua_isnoneornil(long ptr, int index)
      Wrapper of lua_isnoneornil
      
       [-0, +0, –]
       
      
       int lua_isnoneornil (lua_State *L, int index);
       

      Returns 1 if the given index is not valid or if the value at this index is nil, and 0 otherwise.

      Specified by:
      lua_isnoneornil in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • lua_isnumber

      public int lua_isnumber(long ptr, int index)
      Wrapper of lua_isnumber
      
       [-0, +0, –]
       
      
       int lua_isnumber (lua_State *L, int index);
       

      Returns 1 if the value at the given index is a number or a string convertible to a number, and 0 otherwise.

      Specified by:
      lua_isnumber in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • lua_isstring

      public int lua_isstring(long ptr, int index)
      Wrapper of lua_isstring
      
       [-0, +0, –]
       
      
       int lua_isstring (lua_State *L, int index);
       

      Returns 1 if the value at the given index is a string or a number (which is always convertible to a string), and 0 otherwise.

      Specified by:
      lua_isstring in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • lua_istable

      public int lua_istable(long ptr, int index)
      Wrapper of lua_istable
      
       [-0, +0, –]
       
      
       int lua_istable (lua_State *L, int index);
       

      Returns 1 if the value at the given index is a table, and 0 otherwise.

      Specified by:
      lua_istable in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • lua_isthread

      public int lua_isthread(long ptr, int index)
      Wrapper of lua_isthread
      
       [-0, +0, –]
       
      
       int lua_isthread (lua_State *L, int index);
       

      Returns 1 if the value at the given index is a thread, and 0 otherwise.

      Specified by:
      lua_isthread in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • lua_isuserdata

      public int lua_isuserdata(long ptr, int index)
      Wrapper of lua_isuserdata
      
       [-0, +0, –]
       
      
       int lua_isuserdata (lua_State *L, int index);
       

      Returns 1 if the value at the given index is a userdata (either full or light), and 0 otherwise.

      Specified by:
      lua_isuserdata in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • lua_isyieldable

      public int lua_isyieldable(long ptr)
      Wrapper of lua_isyieldable
      
       [-0, +0, –]
       
      
       int lua_isyieldable (lua_State *L);
       

      Returns 1 if the given coroutine can yield, and 0 otherwise.

      Parameters:
      ptr - the lua_State* pointer
      Returns:
      see description
    • lua_len

      public void lua_len(long ptr, int index)
      Wrapper of lua_len
      
       [-0, +1, e]
       
      
       void lua_len (lua_State *L, int index);
       

      Returns the length of the value at the given index. It is equivalent to the '#' operator in Lua (see §3.4.7) and may trigger a metamethod for the "length" event (see §2.4). The result is pushed on the stack.

      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
    • lua_newtable

      public void lua_newtable(long ptr)
      Wrapper of 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).

      Specified by:
      lua_newtable in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
    • lua_newthread

      public long lua_newthread(long ptr)
      Wrapper of 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 thread returned by this function shares with the original thread its global environment, but has an independent execution stack.

      Threads are subject to garbage collection, like any Lua object.

      Specified by:
      lua_newthread in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      Returns:
      see description
    • lua_newuserdatauv

      public long lua_newuserdatauv(long ptr, long size, int nuvalue)
      Wrapper of lua_newuserdatauv
      
       [-0, +1, m]
       
      
       void *lua_newuserdatauv (lua_State *L, size_t size, int nuvalue);
       

      This function creates and pushes on the stack a new full userdata, with nuvalue associated Lua values, called user values, plus an associated block of raw memory with size bytes. (The user values can be set and read with the functions lua_setiuservalue and lua_getiuservalue.)

      The function returns the address of the block of memory. Lua ensures that this address is valid as long as the corresponding userdata is alive (see §2.5). Moreover, if the userdata is marked for finalization (see §2.5.3), its address is valid at least until the call to its finalizer.

      Parameters:
      ptr - the lua_State* pointer
      size - size
      nuvalue - number of associated Lua values (user values)
      Returns:
      see description
    • lua_next

      public int lua_next(long ptr, int index)
      Wrapper of lua_next
      
       [-1, +(2|0), v]
       
      
       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 table 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, avoid calling lua_tolstring directly on a key, unless you know that the key is actually a string. Recall that lua_tolstring may change the value at the given index; this confuses the next call to lua_next.

      This function may raise an error if the given key is neither nil nor present in the table. See function next for the caveats of modifying the table during its traversal.

      Specified by:
      lua_next in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • lua_pcall

      public int lua_pcall(long ptr, int nargs, int nresults, int msgh)
      Wrapper of lua_pcall
      
       [-(nargs + 1), +(nresults|1), –]
       
      
       int lua_pcall (lua_State *L, int nargs, int nresults, int msgh);
       

      Calls a function (or a callable object) 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 object), and returns an error code. Like lua_call, lua_pcall always removes the function and its arguments from the stack.

      If msgh is 0, then the error object returned on the stack is exactly the original error object. Otherwise, msgh is the stack index of a message handler. (This index cannot be a pseudo-index.) In case of runtime errors, this handler will be called with the error object and its return value will be the object returned on the stack by lua_pcall.

      Typically, the message handler is used to add more debug information to the error object, 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 one of the following status codes: LUA_OK, LUA_ERRRUN, LUA_ERRMEM, or LUA_ERRERR.

      Specified by:
      lua_pcall in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      nargs - the number of arguments that you pushed onto the stack
      nresults - the number of results, or LUA_MULTRET
      msgh - stack position of message handler
      Returns:
      see description
    • lua_pop

      public void lua_pop(long ptr, int n)
      Wrapper of lua_pop
      
       [-n, +0, e]
       
      
       void lua_pop (lua_State *L, int n);
       

      Pops n elements from the stack. It is implemented as a macro over lua_settop.

      Specified by:
      lua_pop in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      n - the number of elements
    • lua_pushboolean

      public void lua_pushboolean(long ptr, int b)
      Wrapper of lua_pushboolean
      
       [-0, +1, –]
       
      
       void lua_pushboolean (lua_State *L, int b);
       

      Pushes a boolean value with value b onto the stack.

      Specified by:
      lua_pushboolean in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      b - boolean
    • lua_pushglobaltable

      public void lua_pushglobaltable(long ptr)
      Wrapper of lua_pushglobaltable
      
       [-0, +1, –]
       
      
       void lua_pushglobaltable (lua_State *L);
       

      Pushes the global environment onto the stack.

      Parameters:
      ptr - the lua_State* pointer
    • lua_pushinteger

      public void lua_pushinteger(long ptr, long n)
      Wrapper of lua_pushinteger
      
       [-0, +1, –]
       
      
       void lua_pushinteger (lua_State *L, lua_Integer n);
       

      Pushes an integer with value n onto the stack.

      Specified by:
      lua_pushinteger in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      n - the number / the number of elements
    • lua_pushlightuserdata

      public void lua_pushlightuserdata(long ptr, long p)
      Wrapper of 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, a void*. 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.

      Specified by:
      lua_pushlightuserdata in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      p - the pointer
    • lua_pushnil

      public void lua_pushnil(long ptr)
      Wrapper of lua_pushnil
      
       [-0, +1, –]
       
      
       void lua_pushnil (lua_State *L);
       

      Pushes a nil value onto the stack.

      Specified by:
      lua_pushnil in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
    • lua_pushnumber

      public void lua_pushnumber(long ptr, double n)
      Wrapper of lua_pushnumber
      
       [-0, +1, –]
       
      
       void lua_pushnumber (lua_State *L, lua_Number n);
       

      Pushes a float with value n onto the stack.

      Specified by:
      lua_pushnumber in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      n - the number / the number of elements
    • lua_pushstring

      public String lua_pushstring(long ptr, String s)
      Wrapper of lua_pushstring
      
       [-0, +1, m]
       
      
       const char *lua_pushstring (lua_State *L, const char *s);
       

      Pushes the zero-terminated string pointed to by s onto the stack. Lua will make or reuse an internal copy of the given string, so the memory at s can be freed or reused immediately after the function returns.

      Returns a pointer to the internal copy of the string (see §4.1.3).

      If s is NULL, pushes nil and returns NULL.

      Parameters:
      ptr - the lua_State* pointer
      s - the string
      Returns:
      see description
    • luaJ_pushstring

      public void luaJ_pushstring(long ptr, String s)
      Wrapper of lua_pushstring
      
       [-0, +1, m]
       
      
       const char *lua_pushstring (lua_State *L, const char *s);
       

      Pushes the zero-terminated string pointed to by s onto the stack. Lua will make or reuse an internal copy of the given string, so the memory at s can be freed or reused immediately after the function returns.

      Returns a pointer to the internal copy of the string (see §4.1.3).

      If s is NULL, pushes nil and returns NULL.

      Specified by:
      luaJ_pushstring in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      s - the string
    • lua_pushthread

      public int lua_pushthread(long ptr)
      Wrapper of 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.

      Specified by:
      lua_pushthread in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      Returns:
      see description
    • lua_pushvalue

      public void lua_pushvalue(long ptr, int index)
      Wrapper of lua_pushvalue
      
       [-0, +1, –]
       
      
       void lua_pushvalue (lua_State *L, int index);
       

      Pushes a copy of the element at the given index onto the stack.

      Specified by:
      lua_pushvalue in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
    • lua_rawequal

      public int lua_rawequal(long ptr, int index1, int index2)
      Wrapper of lua_rawequal
      
       [-0, +0, –]
       
      
       int lua_rawequal (lua_State *L, int index1, int index2);
       

      Returns 1 if the two values in indices index1 and index2 are primitively equal (that is, equal without calling the __eq metamethod). Otherwise returns 0. Also returns 0 if any of the indices are not valid.

      Specified by:
      lua_rawequal in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index1 - the stack position of the first element
      index2 - the stack position of the second element
      Returns:
      see description
    • lua_rawget

      public int lua_rawget(long ptr, int index)
      Wrapper of lua_rawget
      
       [-1, +1, –]
       
      
       int lua_rawget (lua_State *L, int index);
       

      Similar to lua_gettable, but does a raw access (i.e., without metamethods). The value at index must be a table.

      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • luaJ_rawget

      public void luaJ_rawget(long ptr, int index)
      Wrapper of lua_rawget
      
       [-1, +1, –]
       
      
       int lua_rawget (lua_State *L, int index);
       

      Similar to lua_gettable, but does a raw access (i.e., without metamethods). The value at index must be a table.

      Specified by:
      luaJ_rawget in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
    • lua_rawgeti

      public int lua_rawgeti(long ptr, int index, long n)
      Wrapper of lua_rawgeti
      
       [-0, +1, –]
       
      
       int lua_rawgeti (lua_State *L, int index, lua_Integer n);
       

      Pushes onto the stack the value t[n], where t is the table at the given index. The access is raw, that is, it does not use the __index metavalue.

      Returns the type of the pushed value.

      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      n - the number / the number of elements
      Returns:
      see description
    • luaJ_rawgeti

      public void luaJ_rawgeti(long ptr, int index, int n)
      Wrapper of lua_rawgeti
      
       [-0, +1, –]
       
      
       int lua_rawgeti (lua_State *L, int index, lua_Integer n);
       

      Pushes onto the stack the value t[n], where t is the table at the given index. The access is raw, that is, it does not use the __index metavalue.

      Returns the type of the pushed value.

      Specified by:
      luaJ_rawgeti in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      n - the number of elements
    • lua_rawgetp

      public int lua_rawgetp(long ptr, int index, long p)
      Wrapper of lua_rawgetp
      
       [-0, +1, –]
       
      
       int lua_rawgetp (lua_State *L, int index, const void *p);
       

      Pushes onto the stack the value t[k], where t is the table at the given index and k is the pointer p represented as a light userdata. The access is raw; that is, it does not use the __index metavalue.

      Returns the type of the pushed value.

      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      p - the lightuserdata
      Returns:
      see description
    • lua_rawlen

      public long lua_rawlen(long ptr, int index)
      Wrapper of lua_rawlen
      
       [-0, +0, –]
       
      
       lua_Unsigned lua_rawlen (lua_State *L, int index);
       

      Returns the raw "length" of the value at the given index: for strings, this is the string length; for tables, this is the result of the length operator ('#') with no metamethods; for userdata, this is the size of the block of memory allocated for the userdata. For other values, this call returns 0.

      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • lua_rawset

      public void lua_rawset(long ptr, int index)
      Wrapper of 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). The value at index must be a table.

      Specified by:
      lua_rawset in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
    • lua_rawseti

      public void lua_rawseti(long ptr, int index, int i)
      Wrapper of lua_rawseti
      
       [-1, +0, m]
       
      
       void lua_rawseti (lua_State *L, int index, lua_Integer i);
       

      Does the equivalent of t[i] = v, where t is the table at the given index and v is the value on the top of the stack.

      This function pops the value from the stack. The assignment is raw, that is, it does not use the __newindex metavalue.

      Specified by:
      lua_rawseti in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      i - i
    • lua_rawsetp

      public void lua_rawsetp(long ptr, int index, long p)
      Wrapper of lua_rawsetp
      
       [-1, +0, m]
       
      
       void lua_rawsetp (lua_State *L, int index, const void *p);
       

      Does the equivalent of t[p] = v, where t is the table at the given index, p is encoded as a light userdata, and v is the value on the top of the stack.

      This function pops the value from the stack. The assignment is raw, that is, it does not use the __newindex metavalue.

      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      p - the lightuserdata
    • lua_remove

      public void lua_remove(long ptr, int index)
      Wrapper of 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. This function cannot be called with a pseudo-index, because a pseudo-index is not an actual stack position.

      Specified by:
      lua_remove in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
    • lua_replace

      public void lua_replace(long ptr, int index)
      Wrapper of lua_replace
      
       [-1, +0, –]
       
      
       void lua_replace (lua_State *L, int index);
       

      Moves the top element into the given valid index without shifting any element (therefore replacing the value at that given index), and then pops the top element.

      Specified by:
      lua_replace in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
    • lua_resume

      public int lua_resume(long ptr, long from, int nargs, long nresults)
      Wrapper of lua_resume
      
       [-?, +?, –]
       
      
       int lua_resume (lua_State *L, lua_State *from, int nargs,
                                 int *nresults);
       

      Starts and resumes a coroutine in the given thread L.

      To start a coroutine, you push the main function plus any arguments onto the empty stack of the thread. then you call lua_resume, with nargs being the number of arguments. The function returns when the coroutine suspends, finishes its execution, or raises an unprotected error. When it returns without errors, *nresults is updated and the top of the stack contains the *nresults values passed to lua_yield or returned by the body function. lua_resume returns LUA_YIELD if the coroutine yields, LUA_OK if the coroutine finishes its execution without errors, or an error code in case of errors (see §4.4.1). In case of errors, the error object is pushed on the top of the stack. (In that case, nresults is not updated, as its value would have to be 1 for the sole error object.)

      To resume a suspended coroutine, you remove the *nresults yielded values from its stack, push the values to be passed as results from yield, and then call lua_resume.

      The parameter from represents the coroutine that is resuming L. If there is no such coroutine, this parameter can be NULL.

      Parameters:
      ptr - the lua_State* pointer
      from - a thread
      nargs - the number of arguments that you pushed onto the stack
      nresults - pointer to the number of results
      Returns:
      see description
    • lua_rotate

      public void lua_rotate(long ptr, int idx, int n)
      Wrapper of lua_rotate
      
       [-0, +0, –]
       
      
       void lua_rotate (lua_State *L, int idx, int n);
       

      Rotates the stack elements between the valid index idx and the top of the stack. The elements are rotated n positions in the direction of the top, for a positive n, or -n positions in the direction of the bottom, for a negative n. The absolute value of n must not be greater than the size of the slice being rotated. This function cannot be called with a pseudo-index, because a pseudo-index is not an actual stack position.

      Parameters:
      ptr - the lua_State* pointer
      idx - the stack position
      n - the number of elements
    • lua_setfield

      public void lua_setfield(long ptr, int index, String k)
      Wrapper of 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 index and v is the value on 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.4).

      Specified by:
      lua_setfield in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      k - the field name
    • lua_setglobal

      public void lua_setglobal(long ptr, String name)
      Wrapper of 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.

      Specified by:
      lua_setglobal in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      name - the name
    • lua_seti

      public void lua_seti(long ptr, int index, long n)
      Wrapper of lua_seti
      
       [-1, +0, e]
       
      
       void lua_seti (lua_State *L, int index, lua_Integer n);
       

      Does the equivalent to t[n] = v, where t is the value at the given index and v is the value on 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.4).

      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      n - the number / the number of elements
    • lua_setiuservalue

      public int lua_setiuservalue(long ptr, int index, int n)
      Wrapper of lua_setiuservalue
      
       [-1, +0, –]
       
      
       int lua_setiuservalue (lua_State *L, int index, int n);
       

      Pops a value from the stack and sets it as the new n-th user value associated to the full userdata at the given index. Returns 0 if the userdata does not have that value.

      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      n - the number of elements
      Returns:
      see description
    • lua_setmetatable

      public int lua_setmetatable(long ptr, int index)
      Wrapper of lua_setmetatable
      
       [-1, +0, –]
       
      
       int lua_setmetatable (lua_State *L, int index);
       

      Pops a table or nil from the stack and sets that value as the new metatable for the value at the given index. (nil means no metatable.)

      (For historical reasons, this function returns an int, which now is always 1.)

      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • luaJ_setmetatable

      public void luaJ_setmetatable(long ptr, int index)
      Wrapper of lua_setmetatable
      
       [-1, +0, –]
       
      
       int lua_setmetatable (lua_State *L, int index);
       

      Pops a table or nil from the stack and sets that value as the new metatable for the value at the given index. (nil means no metatable.)

      (For historical reasons, this function returns an int, which now is always 1.)

      Specified by:
      luaJ_setmetatable in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
    • lua_settable

      public void lua_settable(long ptr, int index)
      Wrapper of 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 index, v is the value on 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.4).

      Specified by:
      lua_settable in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
    • lua_settop

      public void lua_settop(long ptr, int index)
      Wrapper of lua_settop
      
       [-?, +?, e]
       
      
       void lua_settop (lua_State *L, int index);
       

      Receives any acceptable stack index, or 0, and sets the stack top to this index. If the new top is greater than the old one, then the new elements are filled with nil. If index is 0, then all stack elements are removed.

      This function can run arbitrary code when removing an index marked as to-be-closed from the stack.

      Specified by:
      lua_settop in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
    • lua_status

      public int lua_status(long ptr)
      Wrapper of lua_status
      
       [-0, +0, –]
       
      
       int lua_status (lua_State *L);
       

      Returns the status of the thread L.

      The status can be LUA_OK for a normal thread, an error code if the thread finished the execution of a lua_resume with an error, or LUA_YIELD if the thread is suspended.

      You can call functions only in threads with status LUA_OK. You can resume threads with status LUA_OK (to start a new coroutine) or LUA_YIELD (to resume a coroutine).

      Specified by:
      lua_status in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      Returns:
      see description
    • lua_stringtonumber

      public long lua_stringtonumber(long ptr, String s)
      Wrapper of lua_stringtonumber
      
       [-0, +1, –]
       
      
       size_t lua_stringtonumber (lua_State *L, const char *s);
       

      Converts the zero-terminated string s to a number, pushes that number into the stack, and returns the total size of the string, that is, its length plus one. The conversion can result in an integer or a float, according to the lexical conventions of Lua (see §3.1). The string may have leading and trailing whitespaces and a sign. If the string is not a valid numeral, returns 0 and pushes nothing. (Note that the result can be used as a boolean, true if the conversion succeeds.)

      Parameters:
      ptr - the lua_State* pointer
      s - the string
      Returns:
      see description
    • lua_toboolean

      public int lua_toboolean(long ptr, int index)
      Wrapper of lua_toboolean
      
       [-0, +0, –]
       
      
       int lua_toboolean (lua_State *L, int index);
       

      Converts the Lua value at the given index to a C boolean value (0 or 1). Like all tests in Lua, lua_toboolean returns true for any Lua value different from false and nil; otherwise it returns false. (If you want to accept only actual boolean values, use lua_isboolean to test the value's type.)

      Specified by:
      lua_toboolean in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • lua_toclose

      public void lua_toclose(long ptr, int index)
      Wrapper of lua_toclose
      
       [-0, +0, v]
       
      
       void lua_toclose (lua_State *L, int index);
       

      Marks the given index in the stack as a to-be-closed slot (see §3.3.8). Like a to-be-closed variable in Lua, the value at that slot in the stack will be closed when it goes out of scope. Here, in the context of a C function, to go out of scope means that the running function returns to Lua, or there is an error, or the slot is removed from the stack through lua_settop or lua_pop, or there is a call to lua_closeslot. A slot marked as to-be-closed should not be removed from the stack by any other function in the API except lua_settop or lua_pop, unless previously deactivated by lua_closeslot.

      This function raises an error if the value at the given slot neither has a __close metamethod nor is a false value.

      This function should not be called for an index that is equal to or below an active to-be-closed slot.

      Note that, both in case of errors and of a regular return, by the time the __close metamethod runs, the C stack was already unwound, so that any automatic C variable declared in the calling function (e.g., a buffer) will be out of scope.

      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
    • lua_tointeger

      public long lua_tointeger(long ptr, int index)
      Wrapper of lua_tointeger
      
       [-0, +0, –]
       
      
       lua_Integer lua_tointeger (lua_State *L, int index);
       

      Equivalent to lua_tointegerx with isnum equal to NULL.

      Specified by:
      lua_tointeger in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • lua_tointegerx

      public long lua_tointegerx(long ptr, int index, long isnum)
      Wrapper of lua_tointegerx
      
       [-0, +0, –]
       
      
       lua_Integer lua_tointegerx (lua_State *L, int index, int *isnum);
       

      Converts the Lua value at the given index to the signed integral type lua_Integer. The Lua value must be an integer, or a number or string convertible to an integer (see §3.4.3); otherwise, lua_tointegerx returns 0.

      If isnum is not NULL, its referent is assigned a boolean value that indicates whether the operation succeeded.

      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      isnum - pointer to a boolean to be assigned
      Returns:
      see description
    • lua_tonumber

      public double lua_tonumber(long ptr, int index)
      Wrapper of lua_tonumber
      
       [-0, +0, –]
       
      
       lua_Number lua_tonumber (lua_State *L, int index);
       

      Equivalent to lua_tonumberx with isnum equal to NULL.

      Specified by:
      lua_tonumber in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • lua_tonumberx

      public double lua_tonumberx(long ptr, int index, long isnum)
      Wrapper of lua_tonumberx
      
       [-0, +0, –]
       
      
       lua_Number lua_tonumberx (lua_State *L, int index, int *isnum);
       

      Converts the Lua value at the given 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 §3.4.3); otherwise, lua_tonumberx returns 0.

      If isnum is not NULL, its referent is assigned a boolean value that indicates whether the operation succeeded.

      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      isnum - pointer to a boolean to be assigned
      Returns:
      see description
    • lua_topointer

      public long lua_topointer(long ptr, int index)
      Wrapper of lua_topointer
      
       [-0, +0, –]
       
      
       const void *lua_topointer (lua_State *L, int index);
       

      Converts the value at the given index to a generic C pointer (void*). The value can be a userdata, a table, a thread, a string, 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 hashing and debug information.

      Specified by:
      lua_topointer in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • lua_tostring

      public String lua_tostring(long ptr, int index)
      Wrapper of lua_tostring
      
       [-0, +0, m]
       
      
       const char *lua_tostring (lua_State *L, int index);
       

      Equivalent to lua_tolstring with len equal to NULL.

      Specified by:
      lua_tostring in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • lua_tothread

      public long lua_tothread(long ptr, int index)
      Wrapper of lua_tothread
      
       [-0, +0, –]
       
      
       lua_State *lua_tothread (lua_State *L, int index);
       

      Converts the value at the given index to a Lua thread (represented as lua_State*). This value must be a thread; otherwise, the function returns NULL.

      Specified by:
      lua_tothread in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • lua_touserdata

      public long lua_touserdata(long ptr, int index)
      Wrapper of lua_touserdata
      
       [-0, +0, –]
       
      
       void *lua_touserdata (lua_State *L, int index);
       

      If the value at the given index is a full userdata, returns its memory-block address. If the value is a light userdata, returns its value (a pointer). Otherwise, returns NULL.

      Specified by:
      lua_touserdata in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • lua_type

      public int lua_type(long ptr, int index)
      Wrapper of lua_type
      
       [-0, +0, –]
       
      
       int lua_type (lua_State *L, int index);
       

      Returns the type of the value in the given valid index, or LUA_TNONE for a non-valid but acceptable index. 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.

      Specified by:
      lua_type in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • lua_typename

      public String lua_typename(long ptr, int tp)
      Wrapper of 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.

      Specified by:
      lua_typename in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      tp - type id
      Returns:
      see description
    • lua_upvalueindex

      public int lua_upvalueindex(int i)
      Wrapper of lua_upvalueindex
      
       [-0, +0, –]
       
      
       int lua_upvalueindex (int i);
       

      Returns the pseudo-index that represents the i-th upvalue of the running function (see §4.2). i must be in the range [1,256].

      Parameters:
      i - i
      Returns:
      see description
    • lua_version

      public double lua_version(long ptr)
      Wrapper of lua_version
      
       [-0, +0, –]
       
      
       lua_Number lua_version (lua_State *L);
       

      Returns the version number of this core.

      Parameters:
      ptr - the lua_State* pointer
      Returns:
      see description
    • lua_warning

      public void lua_warning(long ptr, String msg, int tocont)
      Wrapper of lua_warning
      
       [-0, +0, –]
       
      
       void lua_warning (lua_State *L, const char *msg, int tocont);
       

      Emits a warning with the given message. A message in a call with tocont true should be continued in another call to this function.

      See warn for more details about warnings.

      Parameters:
      ptr - the lua_State* pointer
      msg - a message
      tocont - continue or not
    • lua_xmove

      public void lua_xmove(long from, long to, int n)
      Wrapper of lua_xmove
      
       [-?, +?, –]
       
      
       void lua_xmove (lua_State *from, lua_State *to, int n);
       

      Exchange values between different threads of the same state.

      This function pops n values from the stack from, and pushes them onto the stack to.

      Specified by:
      lua_xmove in interface LuaNatives
      Parameters:
      from - a thread
      to - another thread
      n - the number of elements
    • lua_yield

      public int lua_yield(long ptr, int nresults)
      Wrapper of lua_yield
      
       [-?, +?, v]
       
      
       int lua_yield (lua_State *L, int nresults);
       

      This function is equivalent to lua_yieldk, but it has no continuation (see §4.5). Therefore, when the thread resumes, it continues the function that called the function calling lua_yield. To avoid surprises, this function should be called only in a tail call.

      Specified by:
      lua_yield in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      nresults - the number of results, or LUA_MULTRET
      Returns:
      see description
    • lua_gethookcount

      public int lua_gethookcount(long ptr)
      Wrapper of lua_gethookcount
      
       [-0, +0, –]
       
      
       int lua_gethookcount (lua_State *L);
       

      Returns the current hook count.

      Specified by:
      lua_gethookcount in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      Returns:
      see description
    • lua_gethookmask

      public int lua_gethookmask(long ptr)
      Wrapper of lua_gethookmask
      
       [-0, +0, –]
       
      
       int lua_gethookmask (lua_State *L);
       

      Returns the current hook mask.

      Specified by:
      lua_gethookmask in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      Returns:
      see description
    • lua_getupvalue

      public String lua_getupvalue(long ptr, int funcindex, int n)
      Wrapper of lua_getupvalue
      
       [-0, +(0|1), –]
       
      
       const char *lua_getupvalue (lua_State *L, int funcindex, int n);
       

      Gets information about the n-th upvalue of the closure at index funcindex. It pushes the upvalue's value onto the stack and returns its name. Returns NULL (and pushes nothing) when the index n is greater than the number of upvalues.

      See debug.getupvalue for more information about upvalues.

      Specified by:
      lua_getupvalue in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      funcindex - the stack position of the closure
      n - the index in the upvalue
      Returns:
      see description
    • lua_setupvalue

      public String lua_setupvalue(long ptr, int funcindex, int n)
      Wrapper of 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 on the top of the stack to the upvalue and returns its name. It also pops the value from the stack.

      Returns NULL (and pops nothing) when the index n is greater than the number of upvalues.

      Parameters funcindex and n are as in the function lua_getupvalue.

      Specified by:
      lua_setupvalue in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      funcindex - the stack position of the closure
      n - the index in the upvalue
      Returns:
      see description
    • lua_upvalueid

      public long lua_upvalueid(long ptr, int funcindex, int n)
      Wrapper of lua_upvalueid
      
       [-0, +0, –]
       
      
       void *lua_upvalueid (lua_State *L, int funcindex, int n);
       

      Returns a unique identifier for the upvalue numbered n from the closure at index funcindex.

      These unique identifiers allow a program to check whether different closures share upvalues. Lua closures that share an upvalue (that is, that access a same external local variable) will return identical ids for those upvalue indices.

      Parameters funcindex and n are as in the function lua_getupvalue, but n cannot be greater than the number of upvalues.

      Parameters:
      ptr - the lua_State* pointer
      funcindex - the stack position of the closure
      n - the index in the upvalue
      Returns:
      see description
    • lua_upvaluejoin

      public void lua_upvaluejoin(long ptr, int funcindex1, int n1, int funcindex2, int n2)
      Wrapper of lua_upvaluejoin
      
       [-0, +0, –]
       
      
       void lua_upvaluejoin (lua_State *L, int funcindex1, int n1,
                                           int funcindex2, int n2);
       

      Make the n1-th upvalue of the Lua closure at index funcindex1 refer to the n2-th upvalue of the Lua closure at index funcindex2.

      Parameters:
      ptr - the lua_State* pointer
      funcindex1 - the stack position of the closure
      n1 - n1
      funcindex2 - the stack position of the closure
      n2 - n2
    • luaL_callmeta

      public int luaL_callmeta(long ptr, int obj, String e)
      Wrapper of 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 passing the object as its only argument. In this case this function returns true and pushes onto the stack the value returned by the call. If there is no metatable or no metamethod, this function returns false without pushing any value on the stack.

      Specified by:
      luaL_callmeta in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      obj - the stack position of the object
      e - field name
      Returns:
      see description
    • luaL_dostring

      public int luaL_dostring(long ptr, String str)
      Wrapper of luaL_dostring
      
       [-0, +?, –]
       
      
       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 (LUA_OK) if there are no errors, or 1 in case of errors.

      Specified by:
      luaL_dostring in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      str - string
      Returns:
      see description
    • luaL_execresult

      public int luaL_execresult(long ptr, int stat)
      Wrapper of luaL_execresult
      
       [-0, +3, m]
       
      
       int luaL_execresult (lua_State *L, int stat);
       

      This function produces the return values for process-related functions in the standard library (os.execute and io.close).

      Parameters:
      ptr - the lua_State* pointer
      stat - (I have no idea)
      Returns:
      see description
    • luaL_fileresult

      public int luaL_fileresult(long ptr, int stat, String fname)
      Wrapper of luaL_fileresult
      
       [-0, +(1|3), m]
       
      
       int luaL_fileresult (lua_State *L, int stat, const char *fname);
       

      This function produces the return values for file-related functions in the standard library (io.open, os.rename, file:seek, etc.).

      Parameters:
      ptr - the lua_State* pointer
      stat - (I have no idea)
      fname - the filename
      Returns:
      see description
    • luaL_getmetafield

      public int luaL_getmetafield(long ptr, int obj, String e)
      Wrapper of 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 and returns the type of the pushed value. If the object does not have a metatable, or if the metatable does not have this field, pushes nothing and returns LUA_TNIL.

      Specified by:
      luaL_getmetafield in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      obj - the stack position of the object
      e - field name
      Returns:
      see description
    • luaL_getmetatable

      public int luaL_getmetatable(long ptr, String tname)
      Wrapper of luaL_getmetatable
      
       [-0, +1, m]
       
      
       int luaL_getmetatable (lua_State *L, const char *tname);
       

      Pushes onto the stack the metatable associated with the name tname in the registry (see luaL_newmetatable), or nil if there is no metatable associated with that name. Returns the type of the pushed value.

      Parameters:
      ptr - the lua_State* pointer
      tname - type name
      Returns:
      see description
    • luaJ_getmetatable

      public void luaJ_getmetatable(long ptr, String tname)
      Wrapper of luaL_getmetatable
      
       [-0, +1, m]
       
      
       int luaL_getmetatable (lua_State *L, const char *tname);
       

      Pushes onto the stack the metatable associated with the name tname in the registry (see luaL_newmetatable), or nil if there is no metatable associated with that name. Returns the type of the pushed value.

      Specified by:
      luaJ_getmetatable in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      tname - type name
    • luaL_getsubtable

      public int luaL_getsubtable(long ptr, int idx, String fname)
      Wrapper of luaL_getsubtable
      
       [-0, +1, e]
       
      
       int luaL_getsubtable (lua_State *L, int idx, const char *fname);
       

      Ensures that the value t[fname], where t is the value at index idx, is a table, and pushes that table onto the stack. Returns true if it finds a previous table there and false if it creates a new table.

      Parameters:
      ptr - the lua_State* pointer
      idx - the stack position
      fname - the filename
      Returns:
      see description
    • luaL_gsub

      public String luaL_gsub(long ptr, String s, String p, String r)
      Wrapper of 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, replacing any occurrence of the string p with the string r. Pushes the resulting string on the stack and returns it.

      Parameters:
      ptr - the lua_State* pointer
      s - the string
      p - the replaced sequence
      r - the replacing string
      Returns:
      see description
    • luaL_len

      public long luaL_len(long ptr, int index)
      Wrapper of luaL_len
      
       [-0, +0, e]
       
      
       lua_Integer luaL_len (lua_State *L, int index);
       

      Returns the "length" of the value at the given index as a number; it is equivalent to the '#' operator in Lua (see §3.4.7). Raises an error if the result of the operation is not an integer. (This case can only happen through metamethods.)

      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • luaL_loadstring

      public int luaL_loadstring(long ptr, String s)
      Wrapper of luaL_loadstring
      
       [-0, +1, –]
       
      
       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.

      Specified by:
      luaL_loadstring in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      s - the string
      Returns:
      see description
    • luaL_newmetatable

      public int luaL_newmetatable(long ptr, String tname)
      Wrapper of 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 to this new table the pair __name = tname, adds to the registry the pair [tname] = new table, and returns 1.

      In both cases, the function pushes onto the stack the final value associated with tname in the registry.

      Specified by:
      luaL_newmetatable in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      tname - type name
      Returns:
      see description
    • luaL_newstate

      public long luaL_newstate(int lid)
      Wrapper of luaL_newstate
      
       [-0, +0, –]
       
      
       lua_State *luaL_newstate (void);
       

      Creates a new Lua state. It calls lua_newstate with luaL_alloc as the allocator function and the result of luaL_makeseed(NULL) as the seed, and then sets a warning function and a panic function (see §4.4) that print messages to the standard error output.

      Returns the new state, or NULL if there is a memory allocation error.

      Specified by:
      luaL_newstate in interface LuaNatives
      Parameters:
      lid - the id of the Lua state, to be used to identify between Java and Lua
      Returns:
      see description
    • luaL_pushfail

      public void luaL_pushfail(long ptr)
      Wrapper of luaL_pushfail
      
       [-0, +1, –]
       
      
       void luaL_pushfail (lua_State *L);
       

      Pushes the fail value onto the stack (see §6).

      Parameters:
      ptr - the lua_State* pointer
    • luaL_ref

      public int luaL_ref(long ptr, int t)
      Wrapper of 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 on the top of the stack (and pops the object).

      The reference system uses the integer keys of the table. A reference is a unique integer key; luaL_ref ensures the uniqueness of the keys it returns. The entry 1 is reserved for internal use. Before the first use of luaL_ref, the integer keys of the table should form a proper sequence (no holes), and the value at entry 1 should be false: nil if the sequence is empty, false otherwise. You should not manually set integer keys in the table after the first use of luaL_ref.

      You can retrieve an object referred by the reference r by calling lua_rawgeti(L,t,r) or lua_geti(L,t,r). The function luaL_unref frees a reference.

      If the object on 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.

      Specified by:
      luaL_ref in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      t - the stack index
      Returns:
      see description
    • luaL_setmetatable

      public void luaL_setmetatable(long ptr, String tname)
      Wrapper of luaL_setmetatable
      
       [-0, +0, –]
       
      
       void luaL_setmetatable (lua_State *L, const char *tname);
       

      Sets the metatable of the object on the top of the stack as the metatable associated with name tname in the registry (see luaL_newmetatable).

      Parameters:
      ptr - the lua_State* pointer
      tname - type name
    • luaL_testudata

      public long luaL_testudata(long ptr, int arg, String tname)
      Wrapper of luaL_testudata
      
       [-0, +0, m]
       
      
       void *luaL_testudata (lua_State *L, int arg, const char *tname);
       

      This function works like luaL_checkudata, except that, when the test fails, it returns NULL instead of raising an error.

      Parameters:
      ptr - the lua_State* pointer
      arg - function argument index
      tname - type name
      Returns:
      see description
    • luaL_tolstring

      public String luaL_tolstring(long ptr, int idx, long len)
      Wrapper of luaL_tolstring
      
       [-0, +1, e]
       
      
       const char *luaL_tolstring (lua_State *L, int idx, size_t *len);
       

      Converts any Lua value at the given index to a C string in a reasonable format. The resulting string is pushed onto the stack and also returned by the function (see §4.1.3). If len is not NULL, the function also sets *len with the string length.

      If the value has a metatable with a __tostring field, then luaL_tolstring calls the corresponding metamethod with the value as argument, and uses the result of the call as its result.

      Parameters:
      ptr - the lua_State* pointer
      idx - the stack position
      len - pointer to length
      Returns:
      see description
    • luaL_traceback

      public void luaL_traceback(long ptr, long L1, String msg, int level)
      Wrapper of luaL_traceback
      
       [-0, +1, m]
       
      
       void luaL_traceback (lua_State *L, lua_State *L1, const char *msg,
                            int level);
       

      Creates and pushes a traceback of the stack L1. If msg is not NULL, it is appended at the beginning of the traceback. The level parameter tells at which level to start the traceback.

      Parameters:
      ptr - the lua_State* pointer
      L1 - a lua_State* pointer
      msg - a message
      level - the running level
    • luaL_typename

      public String luaL_typename(long ptr, int index)
      Wrapper of 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.

      Specified by:
      luaL_typename in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • luaL_unref

      public void luaL_unref(long ptr, int t, int ref)
      Wrapper of luaL_unref
      
       [-0, +0, –]
       
      
       void luaL_unref (lua_State *L, int t, int ref);
       

      Releases a reference (see luaL_ref). The integer ref must be either LUA_NOREF, LUA_REFNIL, or a reference previously returned by luaL_ref and not already released. If ref is either LUA_NOREF or LUA_REFNIL this function does nothing. Otherwise, the entry is removed from the table, so that the referred object can be collected and the reference ref can be used again by luaL_ref.

      Specified by:
      luaL_unref in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      t - the stack index
      ref - the reference
    • luaL_where

      public void luaL_where(long ptr, int lvl)
      Wrapper of 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.

      Specified by:
      luaL_where in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      lvl - the running level
    • luaL_openlibs

      public void luaL_openlibs(long ptr)
      Wrapper of luaL_openlibs
      
       [-0, +0, e]
       
      
       void luaL_openlibs (lua_State *L);
       

      Opens all standard Lua libraries into the given state.

      Specified by:
      luaL_openlibs in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
    • luaJ_openlib

      public void luaJ_openlib(long ptr, String lib)
      A wrapper function

      Open a library indivisually, alternative to luaL_openlibs

      Specified by:
      luaJ_openlib in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      lib - library name
    • luaJ_compare

      public int luaJ_compare(long ptr, int index1, int index2, int op)
      A wrapper function

      See lua_compare

      Specified by:
      luaJ_compare in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index1 - the stack position of the first element
      index2 - the stack position of the second element
      op - the operator
      Returns:
      see description
    • luaJ_len

      public int luaJ_len(long ptr, int index)
      A wrapper function

      Wrapper of lua_(obj)len

      Specified by:
      luaJ_len in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • luaJ_loadbuffer

      public int luaJ_loadbuffer(long ptr, Buffer buffer, int start, int size, String name)
      A wrapper function

      Load a direct buffer

      Specified by:
      luaJ_loadbuffer in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      buffer - the buffer (expecting direct)
      start - the starting index
      size - size
      name - the name
      Returns:
      see description
    • luaJ_dobuffer

      public int luaJ_dobuffer(long ptr, Buffer buffer, int start, int size, String name)
      A wrapper function

      Run a direct buffer

      Specified by:
      luaJ_dobuffer in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      buffer - the buffer (expecting direct)
      start - the starting index
      size - size
      name - the name
      Returns:
      see description
    • luaJ_resume

      public int luaJ_resume(long ptr, int nargs)
      A wrapper function

      Resume a coroutine

      Specified by:
      luaJ_resume in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      nargs - the number of arguments that you pushed onto the stack
      Returns:
      see description
    • luaJ_pushobject

      public void luaJ_pushobject(long ptr, Object obj)
      A wrapper function

      Push a Java object

      Specified by:
      luaJ_pushobject in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      obj - the Java object
    • luaJ_pushclass

      public void luaJ_pushclass(long ptr, Object clazz)
      A wrapper function

      Push a Java class

      Specified by:
      luaJ_pushclass in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      clazz - the Java class
    • luaJ_pusharray

      public void luaJ_pusharray(long ptr, Object array)
      A wrapper function

      Push a Java array

      Specified by:
      luaJ_pusharray in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      array - the Java array
    • luaJ_pushfunction

      public void luaJ_pushfunction(long ptr, Object func)
      A wrapper function

      Push a JFunction

      Specified by:
      luaJ_pushfunction in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      func - the function object
    • luaJ_pushlstring

      public void luaJ_pushlstring(long ptr, Buffer buffer, int start, int size)
      A wrapper function

      Push a buffer as a raw Lua string

      Specified by:
      luaJ_pushlstring in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      buffer - the buffer (expecting direct)
      start - the starting index
      size - size
    • luaJ_isobject

      public int luaJ_isobject(long ptr, int index)
      A wrapper function

      Is a Java object (including object, array or class)

      Specified by:
      luaJ_isobject in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • luaJ_toobject

      public Object luaJ_toobject(long ptr, int index)
      A wrapper function

      Convert to Java object if it is one

      Specified by:
      luaJ_toobject in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • luaJ_newthread

      public long luaJ_newthread(long ptr, int lid)
      A wrapper function

      Create a new thread

      Specified by:
      luaJ_newthread in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      lid - the id of the Lua state, to be used to identify between Java and Lua
      Returns:
      see description
    • luaJ_initloader

      public int luaJ_initloader(long ptr)
      A wrapper function

      Append a searcher loading from Java side into package.searchers / loaders

      Specified by:
      luaJ_initloader in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      Returns:
      see description
    • luaJ_invokespecial

      public int luaJ_invokespecial(long ptr, Class clazz, String method, String sig, Object obj, String params)
      A wrapper function

      Runs CallNonvirtual<type>MethodA. See AbstractLua for usages. Parameters should be boxed and pushed on stack.

      Specified by:
      luaJ_invokespecial in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      clazz - the Java class
      method - the method name
      sig - the method signature used in GetMethodID
      obj - the Java object
      params - encoded parameter types
      Returns:
      see description
    • luaJ_isinteger

      public int luaJ_isinteger(long ptr, int index)
      A wrapper function

      See lua_isinteger

      Specified by:
      luaJ_isinteger in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • luaJ_removestateindex

      public void luaJ_removestateindex(long ptr)
      A wrapper function

      Removes the thread from the global registry, thus allowing it to get garbage collected

      Specified by:
      luaJ_removestateindex in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
    • luaJ_gc

      public void luaJ_gc(long ptr)
      A wrapper function

      Performs a full garbage-collection cycle

      Specified by:
      luaJ_gc in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
    • luaJ_dumptobuffer

      public Object luaJ_dumptobuffer(long ptr)
      A wrapper function

      See lua_dump

      Specified by:
      luaJ_dumptobuffer in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      Returns:
      see description
    • luaJ_tobuffer

      public Object luaJ_tobuffer(long ptr, int index)
      A wrapper function

      See lua_tolstring

      Specified by:
      luaJ_tobuffer in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description
    • luaJ_todirectbuffer

      public Object luaJ_todirectbuffer(long ptr, int index)
      A wrapper function

      See lua_tolstring

      Specified by:
      luaJ_todirectbuffer in interface LuaNatives
      Parameters:
      ptr - the lua_State* pointer
      index - the stack position of the element
      Returns:
      see description