From 1e9612653ee047f258c8473d94f43979adae7cea Mon Sep 17 00:00:00 2001 From: Nicolas BOUQUET Date: Mon, 12 Feb 2024 14:01:45 +0100 Subject: [PATCH] [VM/baselib] fix loadfile/loadstring error reporting --- VM/src/lbaselib.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VM/src/lbaselib.cpp b/VM/src/lbaselib.cpp index 36bc7df74..4281910b1 100644 --- a/VM/src/lbaselib.cpp +++ b/VM/src/lbaselib.cpp @@ -434,7 +434,7 @@ static int luaB_loadfile(lua_State *L) { int nret=luaL_loadfilenamed(L, s, luaL_optstring(L,2,s)); if (nret>0) { lua_pushnil(L); - lua_replace(L,-2); + lua_replace(L,-3); return 2; } if (nret==-1) { @@ -451,7 +451,7 @@ static int luaB_loadstring(lua_State *L) { int nret=luaL_loadbuffer(L, s, sz, luaL_optstring(L,2,"string-chunk")); if (nret>0) { lua_pushnil(L); - lua_replace(L,-2); + lua_replace(L,-3); return 2; } if (nret==-1) {