summaryrefslogtreecommitdiff
path: root/src/scripting/lua.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-02-02 22:42:09 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-02-03 20:54:20 +0100
commit55d2cf8c86df8655fd826443ebe34b1005a9cf90 (patch)
treed5f06084ffac68074963e2038fe0dd8b2c995e18 /src/scripting/lua.cpp
parent48d44a13e525375ef289ef577e5fc6abf1735e19 (diff)
downloadmanaserv-55d2cf8c86df8655fd826443ebe34b1005a9cf90.tar.gz
manaserv-55d2cf8c86df8655fd826443ebe34b1005a9cf90.tar.bz2
manaserv-55d2cf8c86df8655fd826443ebe34b1005a9cf90.tar.xz
manaserv-55d2cf8c86df8655fd826443ebe34b1005a9cf90.zip
Added a generic Lua user data cache
Based on a native Lua table with weak values, so that the user data objects that are created can be garbage collected when no longer referenced. Reviewed-by: Yohann Ferreira
Diffstat (limited to 'src/scripting/lua.cpp')
-rw-r--r--src/scripting/lua.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp
index 63149792..b9c76c23 100644
--- a/src/scripting/lua.cpp
+++ b/src/scripting/lua.cpp
@@ -2703,9 +2703,9 @@ LuaScript::LuaScript():
LuaMapObject::registerType(mState, "MapObject", members_MapObject);
// Make script object available to callback functions.
- lua_pushlightuserdata(mState, (void *)&registryKey);
+ lua_pushlightuserdata(mState, const_cast<char *>(&registryKey));
lua_pushlightuserdata(mState, this);
- lua_settable(mState, LUA_REGISTRYINDEX);
+ lua_rawset(mState, LUA_REGISTRYINDEX);
// Push the error handler to first index of the stack
lua_getglobal(mState, "debug");