Awesome that you fixed it!
But I would like to point out that this
Is only true if you design your system that way Because we are not able to dynamically load arbitrary collections or gui files, you would always know what node you cloned at one point.
For anyone stumbling onto this later here is how you can do it.
A cloned node doesn’t have a id so you would have to give it one to be able to access it.
-- Clone the node and store the resulting nodes
local cloned_tree = gui.clone_tree(gui.get_node("root_node")
-- You can access nodes by doing a table lookup,
-- the names are from the id of the clone node
local seal_root_node = myNode["template/sealROOT"]
If we now clone this node and print it it will show us a table with only one entry, even though the cloned tree with 6 nodes.
local cloned_seal_root = gui.clone_tree(seal_root_node)
pprint(cloned_seal_root)
--[[
{
hash: [] = box@(0, 0, 0),
}
--]]
What we want to do if we want to access our cloned clones is to first give them some ids. The table will now be two entries, one is the node we just named and the other is a “random” node (probably the last), when it tries to add the other nodes they will write over each other as they all share the same key (the key is the id).
gui.set_id(cloned_tree["template/sealROOT"], "sealROOT_clone")
local cloned_seal_root = gui.clone_tree(seal_root_node)
pprint(cloned_seal_root)
--[[
hash: [] = box@(0, 0, 0),
hash: [sealROOT_clone] = box@(800, 800, 1)
--]]
You would most likely dynamically create the node ids and store the id of the node in a table somewhere so you can later access it.