From 724b79b0358c0b65afc207886495942d929c106d Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Sun, 4 Jun 2023 20:20:09 -0700 Subject: [PATCH] Scripting: Fix build against Lua 5.2 --- src/script/engines/lua.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/script/engines/lua.c b/src/script/engines/lua.c index fdc60f856..f2b8e2c4e 100644 --- a/src/script/engines/lua.c +++ b/src/script/engines/lua.c @@ -424,6 +424,7 @@ struct mScriptEngineContext* _luaCreate(struct mScriptEngine2* engine, struct mS lua_getfield(luaContext->lua, -1, "ERRORS"); for (i = 0; i < _mScriptSocketNumErrors; i++) { const struct _mScriptSocketError* err = &_mScriptSocketErrors[i]; + lua_pushinteger(luaContext->lua, err->err); if (err->message) { lua_pushstring(luaContext->lua, err->message); struct mScriptValue* key = mScriptValueAlloc(mSCRIPT_TYPE_MS_S32); @@ -435,7 +436,7 @@ struct mScriptEngineContext* _luaCreate(struct mScriptEngine2* engine, struct mS } else { lua_pushnil(luaContext->lua); } - lua_seti(luaContext->lua, -2, err->err); + lua_settable(luaContext->lua, -3); } lua_pop(luaContext->lua, 2);