I currently have a GUI script that has an on_reload call. The GUI dynamically creates text nodes and stores them in a table, so whenever I reload the game I want to clear references to the old nodes and update the table.
This works fine when reloading a script. I can iterate over the table, delete each node and set each table value to nil. But if I reload that GUI component that has the text nodes in it, those text nodes are deleted and recreated automatically, so when I iterate over the table I get a “deleted node” error, since I’m trying to delete a node that was already deleted.
It seems like I need a solution that either checks for a deleted node before deleting it, or checking if the GUI component specifically was reloaded. Is there a way to do either of these things, and if not, how do you solve this?