Skip to content

Commit 9a8042a

Browse files
Sunrisepeakclaude
andcommitted
fix: lua_newstate signature changed in Lua 5.5 (3 args)
Lua 5.5 added a third 'seed' parameter to lua_newstate(). Use version check to pass the extra argument when needed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7454d2f commit 9a8042a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/capi/lua.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ namespace mcpplibs::capi::lua {
1010
// State Management
1111
// ============================================================================
1212

13-
State* newstate(Alloc f, void* ud) { return ::lua_newstate(f, ud); }
13+
State* newstate(Alloc f, void* ud) {
14+
#if LUA_VERSION_NUM >= 505
15+
return ::lua_newstate(f, ud, 0);
16+
#else
17+
return ::lua_newstate(f, ud);
18+
#endif
19+
}
1420
void close(State* L) { ::lua_close(L); }
1521
State* newthread(State* L) { return ::lua_newthread(L); }
1622
CFunction atpanic(State* L, CFunction panicf) { return ::lua_atpanic(L, panicf); }

0 commit comments

Comments
 (0)