some window moving

This commit is contained in:
Eduardo Bart
2012-02-06 22:41:53 -02:00
parent 08a88e3842
commit 46df3c7dbe
43 changed files with 165 additions and 51 deletions

View File

@@ -50,6 +50,12 @@ void LuaInterface::init()
registerClass<LuaObject>();
bindClassMemberFunction<LuaObject>("getUseCount", &LuaObject::getUseCount);
bindClassMemberFunction<LuaObject>("getClassName", &LuaObject::getClassName);
registerClassMemberFunction<LuaObject>("getFieldsTable", (LuaCppFunction) ([](LuaInterface* lua) {
LuaObjectPtr obj = g_lua.popObject();
obj->luaGetFieldsTable();
return 1;
}));
}
void LuaInterface::terminate()

View File

@@ -65,6 +65,14 @@ void LuaObject::luaGetField(const std::string& key)
}
}
void LuaObject::luaGetFieldsTable()
{
if(m_fieldsTableRef != -1)
g_lua.getRef(m_fieldsTableRef);
else
g_lua.pushNil();
}
int LuaObject::getUseCount()
{
return shared_from_this().use_count() - 1;

View File

@@ -57,6 +57,9 @@ public:
/// Gets a field from this lua object, the result is pushed onto the stack
void luaGetField(const std::string& key);
/// Gets the table containing all stored fields of this lua object, the result is pushed onto the stack
void luaGetFieldsTable();
/// Returns the number of references of this object
/// @note each userdata of this object on lua counts as a reference
int getUseCount();