hello!
i think i remember reading that accessing table items on a display object is less efficient than accessing a general lua table… if this is the case, is it more efficient to have a separate object with regularly accessed items such as player health than to add them to the player display object itself?
or is it only slower to access parameters from the original display object - eg. player.x
in other words is
[lua]
local player = display.newRect(0,0,10,10)
player.health = 100
[/lua]
less efficient than
[lua]
local player = display.newRect(0,0,10,10)
local playerstats={}
playerstats.health=100
[/lua]
or even
[lua]
local player = {}
player.playergfx = display.newRect(0,0,10,10)
player.health = 100
[/lua]
and which do you normally do?
thanks!
andy