From 3874e1607583cccbeeaab848f3e11f9968a14baf Mon Sep 17 00:00:00 2001 From: bol-van Date: Wed, 31 Dec 2025 16:10:22 +0300 Subject: [PATCH] nfqws2: print luajit status at startup --- nfq2/lua.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/nfq2/lua.c b/nfq2/lua.c index c834213..2b7207f 100644 --- a/nfq2/lua.c +++ b/nfq2/lua.c @@ -2870,11 +2870,35 @@ static bool lua_basic_init() #else DLOG_CONDUP("LUA v%u.%u\n",ver/100,ver%100); #endif + #if LUA_VERSION_NUM >= 504 lua_setwarnf(params.L,lua_warn,NULL); #endif lua_atpanic(params.L,lua_panic); luaL_openlibs(params.L); /* Load Lua libraries */ + + lua_getfield(params.L, LUA_REGISTRYINDEX, "_LOADED"); + if (lua_type(params.L, -1)==LUA_TTABLE) + { + lua_getfield(params.L, -1, "jit"); + if (lua_type(params.L, -1)==LUA_TTABLE) + { + lua_getfield(params.L, -1, "status"); + if (lua_type(params.L, -1)==LUA_TFUNCTION) + { + const char *s; + int n = lua_gettop(params.L); + + lua_call(params.L, 0, LUA_MULTRET); + DLOG_CONDUP(lua_toboolean(params.L, n) ? "JIT: ON" : "JIT: OFF"); + for (n++; (s = lua_tostring(params.L, n)); n++) + DLOG_CONDUP(" %s", s); + DLOG_CONDUP("\n"); + } + } + } + lua_settop(params.L, 0); + return true; }