diff --git a/stepmania/src/LuaBinding.cpp b/stepmania/src/LuaBinding.cpp index a7be560567..da2e81cc70 100644 --- a/stepmania/src/LuaBinding.cpp +++ b/stepmania/src/LuaBinding.cpp @@ -142,11 +142,6 @@ void LuaBinding::ApplyDerivedType( Lua *L, const RString &sClassName, void *pSel #include "RageUtil_AutoPtr.h" REGISTER_CLASS_TRAITS( LuaClass, new LuaClass(*pCopy) ) -LuaClass::LuaClass() -{ - m_pSelf = NULL; -} - void *LuaBinding::GetUserdataFromGlobalTable( Lua *L, const char *szType, int iArg ) { if( !GetGlobalTable(L, false) ) @@ -212,60 +207,6 @@ LuaClass::~LuaClass() LUA->Release( L ); } -void LuaClass::BeforeReset() -{ - LuaTable::BeforeReset(); - - /* Read pSelf the name of the class, so we can use them to restore in Register(). */ - Lua *L = LUA->Get(); - - if( !GetGlobalTable(L, false) ) - { - LUA->Release( L ); - return; - } - - this->PushSelf( L ); - lua_rawget( L, -2 ); - if( lua_isnil(L, -1) ) - { - /* This table hasn't been pushed yet. */ - lua_pop( L, 2 ); - LUA->Release( L ); - return; - } - - m_pSelf = lua_touserdata( L, -1 ); - lua_pop( L, 2 ); - - this->PushSelf( L ); - lua_getmetatable( L, -1 ); - lua_rawget( L, LUA_REGISTRYINDEX ); - ASSERT( !lua_isnil(L, -1) ); - m_sClassName = lua_tostring( L, -1 ); - lua_pop( L, 2 ); - - LUA->Release( L ); -} - -void LuaClass::Register() -{ - LuaTable::Register(); - - if( m_pSelf != NULL ) - { - Lua *L = LUA->Get(); - this->PushSelf(L); - LuaBinding::ApplyDerivedType( L, m_sClassName, m_pSelf ); - lua_pop( L, 1 ); - LUA->Release( L ); - - /* To conserve memory, clear the class name. We only need it while restoring. */ - m_sClassName = RString(); - m_pSelf = NULL; - } -} - /* * (c) 2005 Glenn Maynard * All rights reserved. diff --git a/stepmania/src/LuaBinding.h b/stepmania/src/LuaBinding.h index 385671d836..1c2e9bf353 100644 --- a/stepmania/src/LuaBinding.h +++ b/stepmania/src/LuaBinding.h @@ -211,18 +211,10 @@ private: class LuaClass: public LuaTable { public: - LuaClass(); + LuaClass() { } LuaClass( const LuaClass &cpy ); virtual ~LuaClass(); LuaClass &operator=( const LuaClass &cpy ); - -protected: - virtual void BeforeReset(); - virtual void Register(); - - void *m_pSelf; - - RString m_sClassName; }; /* Only a base class has to indicate that it's instanced (has a per-object