diff --git a/src/luaengine/luaengine/LuaEngine.cpp b/src/luaengine/luaengine/LuaEngine.cpp index 3bf2c3b..43dfef9 100644 --- a/src/luaengine/luaengine/LuaEngine.cpp +++ b/src/luaengine/luaengine/LuaEngine.cpp @@ -29,7 +29,8 @@ LuaEngine::LuaEngine(QObject *parent, bool loadBaseLibraries) : QObject(parent) pushPointer("__LuaEngine", (void*)this); pushVariant("DeleteInstant", 0); pushVariant("DeleteLater", 1); - pushFunction("delete", luaDeletePointer_p); + pushFunction("delete", luaObjectDelete_p); + pushFunction("getParent", luaObjectParent_p); pushFunction("connect", luaTriggerConnect_p); pushFunction("disconnect", luaTriggerDisconnect_p); pushFunction("luaEngineVersion", luaEngineVersion_p); @@ -315,7 +316,7 @@ int LuaEngine::getArgumentCount(lua_State *L_p) return lua_gettop(L_p); } -int LuaEngine::luaDeletePointer_p(lua_State *L_p) +int LuaEngine::luaObjectDelete_p(lua_State *L_p) { if (getArgumentCount(L_p) >= 1) { void *pointer = getPointer(L_p, 1); @@ -333,6 +334,18 @@ int LuaEngine::luaDeletePointer_p(lua_State *L_p) return 0; } +int LuaEngine::luaObjectParent_p(lua_State *L_p) +{ + if (getArgumentCount(L_p) >= 1) { + void *pointer = getPointer(L_p, 1); + if (pointer != NULL) { + pushPointer(L_p, ((QObject*)pointer)->parent()); + return 1; + } + } + return 0; +} + int LuaEngine::luaTriggerConnect_p(lua_State *L_p) { if (getArgumentCount(L_p) >= 3) { diff --git a/src/luaengine/luaengine/LuaEngine.h b/src/luaengine/luaengine/LuaEngine.h index ea9f915..99e28a5 100644 --- a/src/luaengine/luaengine/LuaEngine.h +++ b/src/luaengine/luaengine/LuaEngine.h @@ -76,7 +76,8 @@ private: lua_State *L; static int luaEngineVersion_p(lua_State *L_p); static int luaEnginePlatform_p(lua_State *L_p); - static int luaDeletePointer_p(lua_State *L_p); + static int luaObjectDelete_p(lua_State *L_p); + static int luaObjectParent_p(lua_State *L_p); static int luaTriggerConnect_p(lua_State *L_p); static int luaTriggerDisconnect_p(lua_State *L_p); diff --git a/src/luaenginegui/luaengine/LuaEngineGui.cpp b/src/luaenginegui/luaengine/LuaEngineGui.cpp index 04f22c4..0fa5775 100644 --- a/src/luaenginegui/luaengine/LuaEngineGui.cpp +++ b/src/luaenginegui/luaengine/LuaEngineGui.cpp @@ -131,9 +131,6 @@ void LuaEngineGui::pushClass(lua_State *L_p) pushVariant(L_p, "SizePolicyPreferred", (int)QSizePolicy::Preferred); pushVariant(L_p, "SizePolicyExpanding", (int)QSizePolicy::Expanding); pushVariant(L_p, "SizePolicyIgnored", (int)QSizePolicy::Ignored); - - // Object functions - pushFunction(L_p, "getParent", getParent); } void LuaEngineGui::pushClass(LuaEngine *luaEngine) @@ -799,18 +796,6 @@ int LuaEngineGui::createTextEdit(lua_State *L_p) return 1; } -int LuaEngineGui::getParent(lua_State *L_p) -{ - if (getArgumentCount(L_p) >= 1) { - void *pointer = getPointer(L_p, 1); - if (pointer != NULL) { - pushPointer(L_p, ((QObject*)pointer)->parent()); - return 1; - } - } - return 0; -} - int LuaEngineGui::getWidgetText(lua_State *L_p) { if (getArgumentCount(L_p) >= 1) {