Example #1
0
static void userinit (void) {
  lua_baselibopen(L);
  lua_iolibopen(L);
  lua_strlibopen(L);
  lua_mathlibopen(L);
  lua_dblibopen(L);
  /* add your libraries here */
}
Example #2
0
static void userinit (void) {
  lua_baselibopen(L);
  lua_iolibopen(L);
  lua_strlibopen(L);
  lua_mathlibopen(L);
  lua_dblibopen(L);
  /* add your libraries here */
  lua_socketlibopen(L);
  md5lib_open(L);
  wrap_register(L);
  ltime_register(L);
  luaopen_posix(L);
  drop_register(L);
}
Example #3
0
int main(void)
{
 int rc;
 L=lua_open(0);
 lua_baselibopen(L);
 lua_iolibopen(L);
 lua_strlibopen(L);
 lua_mathlibopen(L);
 lua_dblibopen(L);
 start_trace(stderr);
 rc=lua_dofile(L,0);
 stop_trace();
 return rc;
}
Example #4
0
bool kgmLuaOpen()
{
  if(lua_main)
    return false;

  lua_main = lua_open(0);

  if(!lua_main)
    return false;


  lua_baselibopen (lua_main);
  lua_iolibopen (lua_main);
  lua_strlibopen (lua_main);
  lua_mathlibopen (lua_main);
  lua_dblibopen (lua_main);

  return true;
}
Example #5
0
/*
** Python prototype: "lua_state <-- lua_open([stack_size])"
** opens a Lua State and returns it to Python
** accepts an optional parameter informing the size of the stack Lua should use
** (measured in number of elements)
*/
static PyObject *Py_lua_open(PyObject *self, PyObject *args) {
lua_State *L;
int stack_size = 0;
PyObject *result = NULL;

   if (PyArg_ParseTuple(args, "|i:lua_open", &stack_size)) {
      L = lua_open(stack_size);
      lua_baselibopen(L);
      lua_iolibopen(L);
      lua_strlibopen(L);
      lua_mathlibopen(L);
      lua_dblibopen(L);

      lua_register(L, "_LuaPy_callPythonFunction", Lua_callPythonFunction);
      lua_register(L, "_LuaPy_setErrorMessage",    Lua_setErrorMessage);
      lua_dostring(L, LUA_init_state);
      result = Py_BuildValue("i", L);
   }
   return result;
}