mirror of
https://github.com/edubart/otclient.git
synced 2025-10-19 14:03:26 +02:00
some window moving
This commit is contained in:
@@ -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()
|
||||
|
@@ -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;
|
||||
|
@@ -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();
|
||||
|
Reference in New Issue
Block a user