I have a “class” which is like a factory class with nested functions inside of it that controls the instantiated element. I need to call a global function in order to set a variable from within that class. Anyone know how this can be done?
Example:
-- Class
function new(params)
local item = (create image rect)
local item:touch(e)
calltoexternalfunction(e.target.num);
end
item:addEventListener("touch",item);
end
-- Main.lua
local item = require('class');
local myitem = item:new();
function calltoexternalfunction(itemnum)
print("success");
end
Thanks in advance. =) [import]uid: 63800 topic_id: 12598 reply_id: 312598[/import]