return error
This commit is contained in:
@@ -138,23 +138,20 @@ void LuaReference::Unregister()
|
||||
m_iReference = LUA_NOREF;
|
||||
}
|
||||
|
||||
void LuaReference::SetFromExpression( const RString &sExpression )
|
||||
bool LuaReference::SetFromExpression( const RString &sExpression )
|
||||
{
|
||||
RString sFullExpression = "return " + sExpression;
|
||||
SetName( sFullExpression );
|
||||
|
||||
Lua *L = LUA->Get();
|
||||
|
||||
if( !LuaHelpers::RunScript(L, sFullExpression, "expression", 1) )
|
||||
{
|
||||
bool bSuccess = LuaHelpers::RunScript(L, sFullExpression, "expression", 1);
|
||||
if( !bSuccess )
|
||||
this->SetFromNil();
|
||||
LUA->Release( L );
|
||||
return;
|
||||
}
|
||||
|
||||
/* Store the result. */
|
||||
this->SetFromStack( L );
|
||||
else
|
||||
this->SetFromStack( L );
|
||||
LUA->Release( L );
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
RString LuaReference::Serialize() const
|
||||
|
||||
@@ -22,8 +22,9 @@ public:
|
||||
void SetFromNil();
|
||||
|
||||
/* Evaluate an expression that returns an object; store the object in a reference.
|
||||
* For example, evaluating "{ 1, 2, 3 }" will result in a reference to a table. */
|
||||
void SetFromExpression( const RString &sExpression );
|
||||
* For example, evaluating "{ 1, 2, 3 }" will result in a reference to a table.
|
||||
* On success, return true. On error, set to nil and return false. */
|
||||
bool SetFromExpression( const RString &sExpression );
|
||||
|
||||
/* Deep-copy tables, detaching this reference from any others. */
|
||||
void DeepCopy();
|
||||
|
||||
Reference in New Issue
Block a user