コード例 #1
0
void mattorch_init(void) {
  /* Set CWD before starting Lua */
  lua_executable_dir("./lua");

  /* Declare a Lua State, open the Lua State and load all libraries */
  L = lua_open();
  lua_gc(L, LUA_GCSTOP, 0);
  luaL_openlibs(L);
  lua_gc(L, LUA_GCRESTART, 0);
}
コード例 #2
0
ファイル: selflua.c プロジェクト: clementfarabet/selflua
void sl_init(void)
{
  /* Set CWD before starting Lua */
  lua_executable_dir("./lua");

  /* Declare a Lua State, open the Lua State and load all libraries */
  L = lua_open();
  luaL_openlibs(L);
  sl_stack = L;
}
コード例 #3
0
ファイル: luaconf.c プロジェクト: 2ndforks/torch7-custom
const char *
lua_cpath_default()
{
  if (! s_cpath_default)
    {
      const char *dir = lua_executable_dir(0);
      s_cpath_default = LUA_CPATH_DEFAULT_STATIC;
      if (dir)
        s_cpath_default = relocate_path(dir, LUA_CPATH_DEFAULT_STATIC);
    }
  return s_cpath_default;
}
コード例 #4
0
ファイル: paths.c プロジェクト: leesitong/paths
static int 
lua_execdir(lua_State *L)
{
  const char *s = 0;
#if HAVE_LUA_EXECUTABLE_DIR
  s =  lua_executable_dir(0);
#endif
  if (s && s[0])
    lua_pushstring(L, s);
  else
    lua_pushnil(L);
  return 1;
}
コード例 #5
0
ファイル: lua.c プロジェクト: 0w/torch
int main (int argc, char **argv) {
  int status;
  struct Smain s;
#if HAVE_LUA_EXECUTABLE_DIR
  lua_executable_dir(argv[0]);
#endif
  lua_State *L = lua_open();  /* create state */
  if (L == NULL) {
    l_message(argv[0], "cannot create state: not enough memory");
    return EXIT_FAILURE;
  }
  s.argc = argc;
  s.argv = argv;
  status = lua_cpcall(L, &pmain, &s);
  report(L, status);
  lua_close(L);
  return (status || s.status) ? EXIT_FAILURE : EXIT_SUCCESS;
}