Hi,
I’ve got to a strange runtime error.
From my levelController I’m calling remove function on one of the elements [a group]. This element however, has a child element [also a group], which also has a remove() function.
I use these remove functions to cleanup objects, remove all listeners, timers etc. Child object [group] is inserted into parent [group].
However, I have received an error, indicating, that the children element remove() function was called twice. After doing some debugging [and by analyzing the stacktrace one more time] I have found, that the removeSelf() function on child calls remove() function on parent. How can that be?
After changing parent function name to removeMe() it started to work just fine.
For the sake of testing I’ve added a remove function and put there a simple debug line, and guess what - it is called!
Here’s the stacktrace:
[text]
Runtime error
/dist/parent.lua:265: attempt to index global ‘test’ (a nil value) – this is just to prove how it gets called
stack traceback:
[C]: ?
/dist/parent.lua:265: in function ‘remove’
?: in function ‘removeSelf’
/dist/child.lua:150: in function ‘remove’
/dist/parent.lua:271: in function ‘removeArcher’
/dist/levelController.lua:129: in function ‘cleanupLevel’
[/text]
Is this a valid behavior? I would rather have my parent remove children then children trying to remove parent, I didn’t see this error before. I’m using 2012.825 [import]uid: 109453 topic_id: 27443 reply_id: 327443[/import]