[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Table compare
- From: "Alexander Gladysh" <agladysh@...>
- Date: Sat, 27 Dec 2008 20:51:22 +0300
> I assume your question to be restricted to "pure Lua"
> scripting. So a 'crazy Moe' version could be:
> function compareTables(t1, t2)
> return (#a == #b) and (unpack(t1) == unpack(t2))
Sorry to disappoint you, but this would not work for two reasons:
1. Unpack ignores hash-part keys of the table.
2. More important, unpack(t1) == unpack(t2) compares only first
elements of the tables. It is equivalent to t1 == t2. There is
no multi-argument equality operator, only assignment one.