lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On Sat, Dec 27, 2008 at 6:17 PM, G.H. <code933k@gmail.com> wrote:
This unpack usage is -obviously- just limited to _regular tables_.

This is a bit of a semantics issue - I'd consider array-like tables to be the freaky, special kind of table, rather than the non-array-like ones - but more importantly:

Otherwise:

a = { ['x'] = 1, ['y'] = 2}
b = { ['w'] = 4, ['z'] = 2}

return unpack(a) == unpack(b)
true

Try 'unpack({1,2}) == unpack({1,"banana"})'. That will return true as well, because only the first return value of unpack is evaluated on either side - it will be evaluating (1 == 1).

-Duncan