mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add minetest.settings
to CSM API and allow CSMs to provide settingtypes.txt
(#12131)
Co-authored-by: sfan5 <sfan5@live.de> Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
This commit is contained in:
parent
839600ed70
commit
6ec6acc539
9 changed files with 61 additions and 0 deletions
|
@ -417,6 +417,12 @@ void ScriptApiSecurity::setLuaEnv(lua_State *L, int thread)
|
|||
|
||||
bool ScriptApiSecurity::isSecure(lua_State *L)
|
||||
{
|
||||
#ifndef SERVER
|
||||
auto script = ModApiBase::getScriptApiBase(L);
|
||||
// CSM keeps no globals backup but is always secure
|
||||
if (script->getType() == ScriptingType::Client)
|
||||
return true;
|
||||
#endif
|
||||
lua_rawgeti(L, LUA_REGISTRYINDEX, CUSTOM_RIDX_GLOBALS_BACKUP);
|
||||
bool secure = !lua_isnil(L, -1);
|
||||
lua_pop(L, 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue