aboutsummaryrefslogtreecommitdiff
path: root/src/script/cpp_api
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/cpp_api')
-rw-r--r--src/script/cpp_api/s_cheats.h4
-rw-r--r--src/script/cpp_api/s_security.cpp4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/script/cpp_api/s_cheats.h b/src/script/cpp_api/s_cheats.h
index 9b5ace3e7..9f36333b7 100644
--- a/src/script/cpp_api/s_cheats.h
+++ b/src/script/cpp_api/s_cheats.h
@@ -15,7 +15,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
+*/
#pragma once
@@ -44,7 +44,7 @@ public:
~ScriptApiCheatsCategory();
std::string m_name;
void read_cheats(lua_State *L);
- std::vector<ScriptApiCheatsCheat *> m_cheats;
+ std::vector<ScriptApiCheatsCheat *> m_cheats;
};
class ScriptApiCheats : virtual public ScriptApiBase
diff --git a/src/script/cpp_api/s_security.cpp b/src/script/cpp_api/s_security.cpp
index d8ff667eb..9d65819c0 100644
--- a/src/script/cpp_api/s_security.cpp
+++ b/src/script/cpp_api/s_security.cpp
@@ -287,6 +287,10 @@ void ScriptApiSecurity::initializeSecurityClient()
lua_State *L = getStack();
int thread = getThread(L);
+ // Backup globals to the registry
+ lua_getglobal(L, "_G");
+ lua_rawseti(L, LUA_REGISTRYINDEX, CUSTOM_RIDX_GLOBALS_BACKUP);
+
// create an empty environment
createEmptyEnv(L);