Hi,
Is that code a good practice (I am new to Lua)? I have this code in a separate modue I load by calling require(“button”).
Button = {}; -- ============================================================================= -- -- Constuctor -- -- ============================================================================= function Button:new( imageName ) -- Button must search itself for its methods self.\_\_index = self -- New instance button = {} -- Button is metatable for new instance setmetatable( button, self ) -- Create image itself - the Button ancestor self.view = display.newImage( imageName ) -- Set the image as a metatable for Button setmetatable( self, self.view ) return button end