Пример #1
0
static int lj_cf_package_unloadlib(lua_State *L)
{
  void **lib = (void **)luaL_checkudata(L, 1, "_LOADLIB");
  if (*lib) ll_unloadlib(*lib);
  *lib = NULL;  /* mark library as closed */
  return 0;
}
Пример #2
0
/*
** __gc tag method for CLIBS table: calls 'll_unloadlib' for all lib
** handles in list CLIBS
*/
static int gctm (lua_State *L) {
  int n = luaL_len(L, 1);
  for (; n >= 1; n--) {  /* for each handle, in reverse order */
    lua_rawgeti(L, 1, n);  /* get handle CLIBS[n] */
    ll_unloadlib(lua_touserdata(L, -1));
    lua_pop(L, 1);  /* pop handle */
  }
  return 0;
}
Пример #3
0
/* This function makes a clean up atexit */
void lb_quit(void) {
  lua_getfield(L,LUA_REGISTRYINDEX,"_LBCM");
  lua_pushnil(L);
  while (lua_next(L,-2) != 0) {
    ll_unloadlib(lua_touserdata(L,-1));
    remove(lua_tostring(L,-2));
    lua_pop(L,1);
  }
  LBCONF_USERFUNC_DONE(L);
  lua_close(L);
}
Пример #4
0
/*
** __gc tag method: calls library's `ll_unloadlib' function with the lib
** handle
*/
static int gctm (lua_State *L) {
  void** lib = (void**)luaL_checkudata(L, 1, "_LOADLIB");
  if (*lib) ll_unloadlib(*lib);
  *lib = nullptr;  /* mark library as closed */
  return 0;
}