fix LuaReference::operator=
add LuaReference::IsNil
This commit is contained in:
@@ -42,9 +42,14 @@ LuaReference &LuaReference::operator=( const LuaReference &cpy )
|
|||||||
|
|
||||||
Unregister();
|
Unregister();
|
||||||
|
|
||||||
/* Make a new reference. */
|
if( cpy.m_iReference == LUA_NOREF )
|
||||||
lua_rawgeti( LUA->L, LUA_REGISTRYINDEX, cpy.m_iReference );
|
m_iReference = LUA_NOREF;
|
||||||
m_iReference = luaL_ref( LUA->L, LUA_REGISTRYINDEX );
|
else
|
||||||
|
{
|
||||||
|
/* Make a new reference. */
|
||||||
|
lua_rawgeti( LUA->L, LUA_REGISTRYINDEX, cpy.m_iReference );
|
||||||
|
m_iReference = luaL_ref( LUA->L, LUA_REGISTRYINDEX );
|
||||||
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@@ -72,6 +77,11 @@ bool LuaReference::IsSet() const
|
|||||||
return m_iReference != LUA_NOREF;
|
return m_iReference != LUA_NOREF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LuaReference::IsNil() const
|
||||||
|
{
|
||||||
|
return m_iReference == LUA_REFNIL;
|
||||||
|
}
|
||||||
|
|
||||||
int LuaReference::GetLuaType() const
|
int LuaReference::GetLuaType() const
|
||||||
{
|
{
|
||||||
this->PushSelf( LUA->L );
|
this->PushSelf( LUA->L );
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public:
|
|||||||
|
|
||||||
/* Return true if set. (SetFromNil() counts as being set.) */
|
/* Return true if set. (SetFromNil() counts as being set.) */
|
||||||
bool IsSet() const;
|
bool IsSet() const;
|
||||||
|
bool IsNil() const;
|
||||||
void Unset() { Unregister(); }
|
void Unset() { Unregister(); }
|
||||||
|
|
||||||
/* Return the referenced type, or LUA_TNONE if not set. */
|
/* Return the referenced type, or LUA_TNONE if not set. */
|
||||||
|
|||||||
Reference in New Issue
Block a user