Lua 5.5 added a `seed` parameter to `lua_newstate()`. Use a
preprocessor conditional to pass the extra argument when building
against Lua >= 5.5.
Since we require Lua >= 5.3 in src/CMakeLists.txt, we need to be
compatible with Lua 5.5 as well.
See https://www.lua.org/manual/5.5/manual.html#lua_newstate
Signed-off-by: Kefu Chai <k.chai@proxmox.com>
// create new lua state together with reference to the guard
lua_State* newstate(lua_state_guard* guard) {
+#if LUA_VERSION_NUM >= 505
+ lua_State* L = lua_newstate(allocator, guard, 0);
+#else
lua_State* L = lua_newstate(allocator, guard);
+#endif
if (L) {
lua_atpanic(L, [](lua_State* L) -> int {
const char* msg = lua_tostring(L, -1);