[lua] add missing file

personal/stbuehler/wip
Stefan Bühler 10 years ago
parent 0d85a068c8
commit 186309f529
  1. 45
      src/main/base_lua.c

@ -0,0 +1,45 @@
#include <lighttpd/base.h>
#ifdef HAVE_LUA_H
# include <lighttpd/core_lua.h>
# include <lualib.h>
# include <lauxlib.h>
#endif
#ifdef HAVE_LUA_H
void li_lua_init(liLuaState* LL, liServer* srv, liWorker* wrk) {
lua_State *L = LL->L = luaL_newstate();
lua_pushlightuserdata(L, LL);
lua_setfield(L, LUA_REGISTRYINDEX, LI_LUA_REGISTRY_STATE);
luaL_openlibs(LL->L);
li_lua_init2(LL, srv, wrk);
g_static_rec_mutex_init(&LL->lualock);
}
void li_lua_clear(liLuaState* LL) {
lua_close(LL->L);
LL->L = NULL;
g_static_rec_mutex_free(&LL->lualock);
}
#else
void li_lua_init(liLuaState* LL, liServer* srv, liWorker* wrk) {
UNUSED(srv);
UNUSED(wrk);
LL->L = NULL;
g_static_rec_mutex_init(&LL->lualock);
}
void li_lua_clear(liLuaState* LL) {
g_static_rec_mutex_free(&LL->lualock);
}
#endif
Loading…
Cancel
Save