[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Behaviour of table constructors
- From: "Jasper Klein" <jasper@...>
- Date: Sat, 12 Dec 2020 10:51:22 +0100
Op Sat, 12 Dec 2020 10:20:52 +0100 schreef Spar <firstname.lastname@example.org>:
" = 30" is overwritten by next sequential integer which is 3 as well. That's why you see 3 = 40.
t3 table has different order because in PUC Lua expressions in brackets (, [a], ["key"]) always goes to hash part. This is not true in LuaJIT btw.
Ah, I overlooked the Table Constructors paragraph  in the reference manual.
I wasn't able to find more about it in the fourth edition of PIL.
The sentence "Fields of the form exp are equivalent to [i] = exp, where i are consecutive integers starting with 1; fields in the other formats do not affect this counting." applies to the 't2' case, like you said.