I have a file (displayIcon.lua) that contains code for displaying and perform events.
displayIcon.lua
WatchIcon = {} function WatchIcon:new() local self = display.newGroup() Here I add some images in the self group via newImageRect() function WatchIco:setPosition(x, y) self.x = x self.y = y end return self
And then, in the main.lua file, I instantiate the WatchIcon
main.lua
require("displayIcon") local icon = watchIcon:new() icon:setPosition(50,50) -- This code dont work, do not position the image group -- Code bellow work icon.x = 50 icon.y = 50
As you can see, the funcion setPosition inside watchIcon.lua do not work.
The function is executed ( i have confirmed with print function), but the positioning is like ignored.
When I place a regular positioning command in the main.lua file, the position is executed correctly.
Where is the error?
never mind, I have tested again and it worked propertly.
It was late at night when I wrote, so now its ok.
Thanks a lot
Bruno