diff options
author | Kahrl <kahrl@gmx.net> | 2015-08-25 07:00:56 +0200 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2015-08-27 01:56:06 +0200 |
commit | 8658c8d9b5f30dc952eed29a19d619de9210474c (patch) | |
tree | a9f6e6d48d0ac1b3a0d9a566e99a3d74dac63e22 /src/script/cpp_api/s_base.cpp | |
parent | 34b7a147dcf9831f3b4d81599c473ba01ff5da00 (diff) | |
download | minetest-8658c8d9b5f30dc952eed29a19d619de9210474c.tar.gz minetest-8658c8d9b5f30dc952eed29a19d619de9210474c.tar.bz2 minetest-8658c8d9b5f30dc952eed29a19d619de9210474c.zip |
Use numeric indices and raw table access with LUA_REGISTRYINDEX
Diffstat (limited to 'src/script/cpp_api/s_base.cpp')
-rw-r--r-- | src/script/cpp_api/s_base.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/script/cpp_api/s_base.cpp b/src/script/cpp_api/s_base.cpp index dcfbac4bf..bfe03ec46 100644 --- a/src/script/cpp_api/s_base.cpp +++ b/src/script/cpp_api/s_base.cpp @@ -52,13 +52,13 @@ public: { // Store current mod name in registry lua_pushstring(L, mod_name.c_str()); - lua_setfield(L, LUA_REGISTRYINDEX, SCRIPT_MOD_NAME_FIELD); + lua_rawseti(L, LUA_REGISTRYINDEX, CUSTOM_RIDX_CURRENT_MOD_NAME); } ~ModNameStorer() { // Clear current mod name from registry lua_pushnil(L); - lua_setfield(L, LUA_REGISTRYINDEX, SCRIPT_MOD_NAME_FIELD); + lua_rawseti(L, LUA_REGISTRYINDEX, CUSTOM_RIDX_CURRENT_MOD_NAME); } }; @@ -84,7 +84,7 @@ ScriptApiBase::ScriptApiBase() // Make the ScriptApiBase* accessible to ModApiBase lua_pushlightuserdata(m_luastack, this); - lua_setfield(m_luastack, LUA_REGISTRYINDEX, "scriptapi"); + lua_rawseti(m_luastack, LUA_REGISTRYINDEX, CUSTOM_RIDX_SCRIPTAPI); // If we are using LuaJIT add a C++ wrapper function to catch // exceptions thrown in Lua -> C++ calls |