In theory how could I make an undo/redo for a drawing system?

I mean the system that @regexman told me is semi working, do you think your way will work better? I will be just getting the children of the frame for the table, with that way I can also check if there is the max cap and if so then, table.remove(table, 1) which is handy.