From 28a560684b9b9048f8436583805f3f733d7ce829 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Sun, 18 Oct 2020 14:16:18 +0200 Subject: Added the API additions from waspsaliva --- src/script/cpp_api/s_cheats.h | 4 ++-- src/script/cpp_api/s_security.cpp | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src/script/cpp_api') 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 m_cheats; + std::vector 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); -- cgit v1.2.3