Or you could make the lists own the nodes. Newly allocated nodes are owned by global list for which Lua keeps a reference. When you insert a node it in another list, you remove it from the list that owned, so ownership changes. Nodes can be either explicitly destroyed or die when the list that owns them is collected.