Add in_lua flag
In preparation of making config errors available to lua scripts, instead outputting them via pline.
This commit is contained in:
12
src/nhlua.c
12
src/nhlua.c
@@ -1110,6 +1110,7 @@ nhl_init(void)
|
||||
{
|
||||
lua_State *L = luaL_newstate();
|
||||
|
||||
iflags.in_lua = TRUE;
|
||||
luaL_openlibs(L);
|
||||
nhl_set_package_path(L, "./?.lua");
|
||||
|
||||
@@ -1130,13 +1131,20 @@ nhl_init(void)
|
||||
l_obj_register(L);
|
||||
|
||||
if (!nhl_loadlua(L, "nhlib.lua")) {
|
||||
lua_close(L);
|
||||
nhl_done(L);
|
||||
return (lua_State *) 0;
|
||||
}
|
||||
|
||||
return L;
|
||||
}
|
||||
|
||||
void
|
||||
nhl_done(lua_State *L)
|
||||
{
|
||||
lua_close(L);
|
||||
iflags.in_lua = FALSE;
|
||||
}
|
||||
|
||||
boolean
|
||||
load_lua(const char *name)
|
||||
{
|
||||
@@ -1154,7 +1162,7 @@ load_lua(const char *name)
|
||||
}
|
||||
|
||||
give_up:
|
||||
lua_close(L);
|
||||
nhl_done(L);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user