I keep explaining and you keep circling back to the same belief that the object will have all the fields shown in the table used to create it.
That isn’t how it works. I think there is some kind of communication barrier here.
Let me give you an simplified example of how this is probably being done
-- A 'thing' builder (i.e. newButton() builds things) -- Takes a table 'tbl' of parameters. -- Returns a image rectangle with parameters applied. -- local function makeThing( tbl ) local thing = display.newImageRect( tbl.img, tbl.w, tbl.h ) thing.x = tbl.x thing.y = tbl.y if( tbl.fill ) then thing:setFillColor( unpack( tbl.fill ) ) end return thing end local params = { x = 100, y = 50, w = 200, h = 40, img = "images/smiley.png", fill = { 1, 0, 0 } } local myThing = makeThing( params )
At the end of all this, assuming I made no typos, we have:
-
makeAThing() - A builder function that takes a parameterized table and returns an image rect. This is the equivalent of the widget function you’re calling.
-
params - A temporary table I made filled with settings to build a ‘thing’.
-
myThing - A image rect, returned by makeAThing() and built based on the settings in params.
You can set whatever properties myThing (an image rect) has and you can call whatever functions it provides. You can’t expect doing this to have any effect:
myThing.img = "images/bob.png"
This is essentially what you’re expecting to be able to do with widgets and it simply doesn’t work that way. The docs clearly state what properties and functions each of the widget objects has. You can only use those.