Fix crash when require is called from root VM stack

This commit is contained in:
Alex Orlenko 2025-04-24 22:30:20 +01:00 committed by Varun Saini
parent c51743268b
commit 0a5c5c62dc

View file

@ -170,7 +170,8 @@ int lua_proxyrequire(lua_State* L)
int lua_require(lua_State* L) int lua_require(lua_State* L)
{ {
lua_Debug ar; lua_Debug ar;
lua_getinfo(L, 1, "s", &ar); if (!lua_getinfo(L, 1, "s", &ar))
luaL_error(L, "require is not supported in this context");
return lua_requireinternal(L, ar.source); return lua_requireinternal(L, ar.source);
} }