I’d like to forward reference members functions, but haven’t been able to figure out how to go about it. I have an ‘actor’ module that creates a sprite, and contains a number of member functions to manipulate that sprite:
[lua]local DogginsSprite = display.newSprite(imageSheet, sequenceData)
function DogginsSprite.move (x, y)
– move the sprite
end[/lua]
Some of the member functions reference each other, and for easier organization I’d like to forward reference them so the order of the functions doesn’t matter. I tried something like this:
[lua]local DogginsSprite = display.newSprite(imageSheet, sequenceData)
DogginsSprite.idle
DogginsSprite.move
DogginsSprite.rest
function DogginsSprite.move (x, y)
– move the sprite
end[/lua]
…but I get an error saying that an ‘=’ is expected after the variable names. Normally I would declare those with ‘local’, but that doesn’t work, I assume because they are already local to DogginsSprite.
Is there a way to do this?
Thanks!
- David [import]uid: 149111 topic_id: 35758 reply_id: 335758[/import]