Better implementation for forming the singleton wrapper.

This commit is contained in:
BenDol
2014-04-01 17:08:07 +13:00
parent 79ee0e34ea
commit 994f49b3c1
2 changed files with 26 additions and 49 deletions

View File

@@ -332,4 +332,16 @@ function getOppositeAnchor(anchor)
return anchor
end
function makesingleton(obj)
local singleton = {}
if obj.getClassName then
for key,value in pairs(_G[obj:getClassName()]) do
if type(value) == 'function' then
singleton[key] = function(...) value(obj, ...) end
end
end
end
return singleton
end
-- @}