CopyTable() improvement
Posted: Sun Sep 09, 2012 9:26 am
Hi Andreas,
I think it could be useful an improvement of the CopyTable() function to allow us to choice to make a strict copy (like it's working right now) or to make a referenced copy of the subtables.
This come useful for example to handle structures that can trigger recursive copy and make Hollywood crash.
For example I've encountered this problem during HGui and ScuiLib development and now, that I'm writing a simple sprite engine, too because my sorted sprite list reference the sprite objects and the sprites reference the sprite sorted list (to allow multiple lists), this way the sprite cloning using CopyTable() just make Hollywood crash.
I'm handling this problem manually so there is no problem for me, but I think it could be nice to have, at least you could insert a maximum recursion level to let Hollywood does not crash when this problematics are raised.
I think it could be useful an improvement of the CopyTable() function to allow us to choice to make a strict copy (like it's working right now) or to make a referenced copy of the subtables.
This come useful for example to handle structures that can trigger recursive copy and make Hollywood crash.
For example I've encountered this problem during HGui and ScuiLib development and now, that I'm writing a simple sprite engine, too because my sorted sprite list reference the sprite objects and the sprites reference the sprite sorted list (to allow multiple lists), this way the sprite cloning using CopyTable() just make Hollywood crash.
I'm handling this problem manually so there is no problem for me, but I think it could be nice to have, at least you could insert a maximum recursion level to let Hollywood does not crash when this problematics are raised.