Scripting: Fix build against Lua 5.2

This commit is contained in:
Vicki Pfau 2023-06-04 20:20:09 -07:00
parent c37949fee7
commit 724b79b035
1 changed files with 2 additions and 1 deletions

View File

@ -424,6 +424,7 @@ struct mScriptEngineContext* _luaCreate(struct mScriptEngine2* engine, struct mS
lua_getfield(luaContext->lua, -1, "ERRORS"); lua_getfield(luaContext->lua, -1, "ERRORS");
for (i = 0; i < _mScriptSocketNumErrors; i++) { for (i = 0; i < _mScriptSocketNumErrors; i++) {
const struct _mScriptSocketError* err = &_mScriptSocketErrors[i]; const struct _mScriptSocketError* err = &_mScriptSocketErrors[i];
lua_pushinteger(luaContext->lua, err->err);
if (err->message) { if (err->message) {
lua_pushstring(luaContext->lua, err->message); lua_pushstring(luaContext->lua, err->message);
struct mScriptValue* key = mScriptValueAlloc(mSCRIPT_TYPE_MS_S32); struct mScriptValue* key = mScriptValueAlloc(mSCRIPT_TYPE_MS_S32);
@ -435,7 +436,7 @@ struct mScriptEngineContext* _luaCreate(struct mScriptEngine2* engine, struct mS
} else { } else {
lua_pushnil(luaContext->lua); lua_pushnil(luaContext->lua);
} }
lua_seti(luaContext->lua, -2, err->err); lua_settable(luaContext->lua, -3);
} }
lua_pop(luaContext->lua, 2); lua_pop(luaContext->lua, 2);