As a newbie, I’m trying to convert one of my AS2 Flash applications to Lua/Corona to get my feet wet, but am getting hung up on how to reference an object (movie clip in this instance) in a function using an argument.
The original actionscript code looked something like this:
["mymovieclip"+myarg].gotoAndStop(2)
The square brackets merged (concatenated?) “mymovieclip” and the passed in argument just fine when called; for example if myarg=1, the end result would be mymovieclip1.gotoAndStop(2) - which worked in making the MC with the instance name “mymovieclip1” go to and stop at frame 2.
I can’t seem to figure out how to accomplish the same task in Lua. Doing something like the following…
function myFunction(myarg)
mymovieclip[myarg]:stopAtFrame(2)
end
…doesn’t work. When I call the function myFunction(1) I get a runtime error that it can’t index ‘mymovieclip’ (the argument is not being included when calling the object.)
Can anyone point me in the right direction on how to do this properly?
My apologies if it’s as simple as I’d imagine, but I can’t seem to find the appropriate reference and have tried quite a few things to no avail. [import]uid: 49694 topic_id: 20892 reply_id: 320892[/import]