improvment in connect

This commit is contained in:
Eduardo Bart
2012-02-08 20:58:27 -02:00
parent 175f97b98f
commit 55fbb5f1a6
9 changed files with 26 additions and 19 deletions

View File

@@ -20,6 +20,15 @@ end
function connect(object, signalsAndSlots, pushFront)
for signal,slot in pairs(signalsAndSlots) do
if not object[signal] then
local mt = getmetatable(object)
if mt then
object[signal] = function(...)
return signalcall(mt[signal], ...)
end
end
end
if not object[signal] then
object[signal] = slot
elseif type(object[signal]) == 'function' then
@@ -140,7 +149,7 @@ function signalcall(param, ...)
return param(...)
elseif type(param) == 'table' then
for k,v in pairs(param) do
if param(...) then
if v(...) then
return true
end
end