Let’s say I create a display object like this:
[lua]local alien = display.newImage(“alien.png”)[/lua]
…and then later I read in the contents of a text file to a local variable:
[lua]local txt = readFile(“customVars.txt”)[/lua]
For the sake of this example, let’s say the entire contents of that text file are: name = "Bob"
Question…
Is there a way for me to “attach” that content to the existing display object so it now has a property called name with a value of Bob?
So if I do this:
[lua]print(alien.name)[/lua]
…I’d see Bob in the console.
I’ve poked at this for a while and either I’m missing something or it can’t be done. I’d prefer the former, even if it makes me go, “D’oh!” and be embarrassed at how easy it is.
Anyone?
Jay