From f290b4f89c307aeb640b940226ec15e89734e2f0 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Mon, 2 May 2011 01:38:00 -0300 Subject: [PATCH] .. --- data/modules/messagebox/messagebox.lua | 16 +++++++--------- src/framework/script/luafunctions.cpp | 6 +++--- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/data/modules/messagebox/messagebox.lua b/data/modules/messagebox/messagebox.lua index abad025d..44540e8b 100644 --- a/data/modules/messagebox/messagebox.lua +++ b/data/modules/messagebox/messagebox.lua @@ -1,11 +1,9 @@ function messageBox(title, text) - local messageBoxWindow = UI.load("modules/messagebox/messagebox.yml") - local messageBoxLabel = messageBoxWindow:getChildById("messageBoxLabel") - local messageBoxOkButton = messageBoxWindow:getChildById("messageBoxOkButton") - messageBoxWindow.locked = true - messageBoxWindow.title = title - messageBoxLabel.text = text - --messageBoxWindow:setSize(messageBoxLabel:getSize() + Size{20, 20}) - messageBoxWindow.onDestroy = function() self.locked = false end - messageBoxOkButton.onClick = function() messageBoxWindow:destroy() end + local msgbox = UI.load("modules/messagebox/messagebox.yml") + local label = msgbox:getChildById("messageBoxLabel") + local okButton = msgbox:getChildById("messageBoxOkButton") + msgbox.locked = true + msgbox.title = title + label.text = text + okButton.onClick = function() msgbox:destroy() end end diff --git a/src/framework/script/luafunctions.cpp b/src/framework/script/luafunctions.cpp index ef5f2a27..a5da8c72 100644 --- a/src/framework/script/luafunctions.cpp +++ b/src/framework/script/luafunctions.cpp @@ -127,7 +127,7 @@ int lua_UIElement_setOnLoad() g_lua.insert(-2); if(UIElementPtr element = boost::dynamic_pointer_cast(g_lua.popClassInstance())) { int funcRef = g_lua.popFunction(); - element->associateLuaRef(__FUNCTION__, funcRef); + element->associateLuaRef("onLoad", funcRef); element->setOnLoad(g_lua.createScriptableSelfFuncCallback(funcRef)); } else g_lua.pop(); @@ -139,7 +139,7 @@ int lua_UIElement_setOnDestroy() g_lua.insert(-2); if(UIElementPtr element = boost::dynamic_pointer_cast(g_lua.popClassInstance())) { int funcRef = g_lua.popFunction(); - element->associateLuaRef(__FUNCTION__, funcRef); + element->associateLuaRef("onDestroy", funcRef); element->setOnDestroy(g_lua.createScriptableSelfFuncCallback(funcRef)); } else @@ -223,7 +223,7 @@ int lua_UIButton_setOnClick() g_lua.insert(-2); if(UIButtonPtr button = boost::dynamic_pointer_cast(g_lua.popClassInstance())) { int funcRef = g_lua.popFunction(); - button->associateLuaRef(__FUNCTION__, funcRef); + button->associateLuaRef("onClick", funcRef); button->setOnClick(g_lua.createScriptableSelfFuncCallback(funcRef)); } else g_lua.pop();