Passing display method by table, is it possible?

I want to be able to create a table with parameters that are later applied to a display object. Something like so:

1
2
3
4
5
6
local image = display.newImage( "image.png" )
local params = { xScale = 0.5, yScale = 1.3 }
 
for i, p in pairs( params ) do
 image.i = p
end

Try changing line 5 to this:

1
image[i] = p

thanks, it works!

No problem, glad I could help.

views:1422 update:2011/9/30 9:15:39
corona forums © 2003-2011