On Sep 20, 2014, at 5:05 AM, Thiago L. <fakedme@gmail.com> wrote:
Also posted on http://stackoverflow.com/q/25922437/3691554
So I've been writing deep-copy algorithms, and I wanna test them to see if they work the way I want them to. While I do have access to the original->copy map, I want a general-purpose deep-compare algorithm that must be able to compare table keys (tables as keys?). The #Lua channel on Freenode thinks it's impossible, I just think it's really hard.
My deep-copy algorithm(s) are avaliable here: https://gist.github.com/SoniEx2/fc5d3614614e4e3fe131 (it's not very organized, but there are 3 of them, one uses recursive calls, the other uses a todo table, and the other simulates a call stack (in a very ugly but 5.1-compatible way))
I assume you mean “equivalent” rather than “equal”, in the sense that two tables are equal if they have the same content, not are the same table? Otherwise you would be talking shallow compare.
—Tim