On 11.10.2014 19:32, Enrique Garcia Cota wrote:
I did a quick perusal in the code. Does ltdiff support tables-in-keys? I
would test myself but I am on my mobile and will be for a while.
Heh, I haven't thought of that. As long as they use for the key the
exact same table in terms of the address of the table *not* the table
content it should work.
The following example prints the expected result:
ltdiff = require "ltdiff"
utils = require "utils"
local table_as_key = {}
local mytable = { key = "hey" }
mytable[table_as_key] = "hello"
local othertable = utils.deepcopy (mytable)
othertable[table_as_key] = "bye"
local diff = ltdiff.diff (mytable, othertable)
print (diff.mod[table_as_key]) -- prints "bye"
However serializing this diff would be tricky as it would be unclear how
to serialize the key for table_as_key.