From 6ec6acc539321709ed8517f1a571777a04f5c24c Mon Sep 17 00:00:00 2001 From: AFCMS Date: Tue, 2 Aug 2022 11:58:08 +0200 Subject: Add `minetest.settings` to CSM API and allow CSMs to provide `settingtypes.txt` (#12131) Co-authored-by: sfan5 Co-authored-by: SmallJoker --- src/script/cpp_api/s_security.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/script/cpp_api') diff --git a/src/script/cpp_api/s_security.cpp b/src/script/cpp_api/s_security.cpp index 88e22f16f..316b19926 100644 --- a/src/script/cpp_api/s_security.cpp +++ b/src/script/cpp_api/s_security.cpp @@ -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); -- cgit v1.2.3