[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Table compare
- From: Enrico Tassi <gareuselesinge@...>
- Date: Sat, 27 Dec 2008 18:50:23 +0100
On Sat, Dec 27, 2008 at 12:35:53PM -0500, G.H. wrote:
> 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))
> end
This is wrong, it will compare only the first table element:
Lua 5.1.3 Copyright (C) 1994-2008 Lua.org, PUC-Rio
> a={1,2}
> b={1,3}
> = #a == #b and (unpack(a) == unpack(b))
true
Cheers
--
Enrico Tassi