eliminate LuaData type; move Serialize into LuaReference

Nothing uses Serialize right now.  I havn't decided whether
to keep it around.
This commit is contained in:
Glenn Maynard
2006-09-21 01:56:08 +00:00
parent 2e927c3636
commit e0a68a235e
2 changed files with 3 additions and 28 deletions
+1 -19
View File
@@ -157,7 +157,7 @@ void LuaExpression::SetFromExpression( const RString &sExpression )
LUA->Release( L );
}
RString LuaData::Serialize() const
RString LuaReference::Serialize() const
{
/* Call Serialize(t), where t is our referenced object. */
Lua *L = LUA->Get();
@@ -184,24 +184,6 @@ RString LuaData::Serialize() const
return sRet;
}
void LuaData::LoadFromString( const RString &s )
{
Lua *L = LUA->Get();
/* Restore the serialized data by evaluating it. */
RString sError;
if( !LuaHelpers::RunScript( L, s, "serialization", sError, 1 ) )
{
/* Serialize() should never return an invalid script. Drop the failed
* script into the log (it may be too big to pass to FAIL_M) and fail. */
LOG->Warn( "Unserialization of \"%s\" failed: %s", s.c_str(), sError.c_str() );
FAIL_M( "Unserialization failed" );
}
this->SetFromStack( L );
LUA->Release( L );
}
LuaTable::LuaTable()
{
Lua *L = LUA->Get();
+2 -9
View File
@@ -38,6 +38,8 @@ public:
void SetName( const RString &sName );
RString GetName() const { return m_sName; }
RString Serialize() const;
private:
void Unregister();
int m_iReference;
@@ -55,15 +57,6 @@ public:
void SetFromExpression( const RString &sExpression );
};
/* Reference a trivially restorable Lua object (any object that Serialize can handle).
* The object will be saved and restored across Lua resets. */
class LuaData: public LuaReference
{
public:
virtual RString Serialize() const;
virtual void LoadFromString( const RString &s );
};
class LuaTable: public LuaReference
{
public: