I’m trying to get my script to create new image objects in a function, but they need different names, so what I’ve done is created an id variable that increases every time the function is used, then it add’s the id to the string “Block”, therefore making the first block “Block1”, then “Block2”, etc. This is stored in a variable called newBlock. But when I go
newBlock = display.newImage("image.png")
It’ll literally make “newBlock” the object instead of “Block1” or whatever. This would be easy in PHP to fix because when you refer to a variable you have to use a “$” prefix, which let’s the script know it’s actually talking about a variable, not a literal piece of text.
Is there any way to let Lua know I’m talking about a dynamically changing variable here, not a literal piece of text? Or even a better way of doing what I’m trying to do?
Any would be really appreciated! [import]uid: 30068 topic_id: 5798 reply_id: 305798[/import]