Fix error generation in load*.

Reported by Sergey Kaplun. #1353
This commit is contained in:
Mike Pall 2025-04-07 10:27:40 +02:00
parent e9e4b6d302
commit e76bb50d44

View File

@ -108,8 +108,9 @@ LUALIB_API int luaL_loadfilex(lua_State *L, const char *filename,
copyTV(L, L->top-1, L->top);
}
if (err) {
const char *fname = filename ? filename : "stdin";
L->top--;
lua_pushfstring(L, "cannot read %s: %s", chunkname+1, strerror(err));
lua_pushfstring(L, "cannot read %s: %s", fname, strerror(err));
return LUA_ERRFILE;
}
return status;