mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Use numeric indices and raw table access with LUA_REGISTRYINDEX
This commit is contained in:
parent
34b7a147dc
commit
8658c8d9b5
7 changed files with 36 additions and 16 deletions
|
@ -371,7 +371,7 @@ int ModApiUtil::l_request_insecure_environment(lua_State *L)
|
|||
lua_getglobal(L, "_G");
|
||||
return 1;
|
||||
}
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, SCRIPT_MOD_NAME_FIELD);
|
||||
lua_rawgeti(L, LUA_REGISTRYINDEX, CUSTOM_RIDX_CURRENT_MOD_NAME);
|
||||
if (!lua_isstring(L, -1)) {
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
|
@ -383,7 +383,7 @@ int ModApiUtil::l_request_insecure_environment(lua_State *L)
|
|||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
lua_getfield(L, LUA_REGISTRYINDEX, "globals_backup");
|
||||
lua_rawgeti(L, LUA_REGISTRYINDEX, CUSTOM_RIDX_GLOBALS_BACKUP);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue