mirror of
https://github.com/edubart/otclient.git
synced 2025-10-20 06:23:26 +02:00
Better implementation for forming the singleton wrapper.
This commit is contained in:
@@ -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
|
||||
|
||||
-- @}
|
Reference in New Issue
Block a user