[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Arrays and Tables
- From: Dibyendu Majumdar <mobile@...>
- Date: Sun, 25 Jun 2017 09:42:25 +0100
Hi Roberto,
On 25 June 2017 at 08:03, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
>> I was looking to see if Lua ever had a distinct array type, and
>> reading the hopl paper it seems that Lua 1.1 indeed had distinct array
>> and table types but the two types were merged to a single table type
>> in Lua 2.1.
>
> That is not true. Lua 1.1 had distinct notations for constructors of
> arrays (lists) and records, but the underling table was already the same:
>
Ah, okay. I misunderstood following to mean that there were distinct types:
The form ‘@[]’ was used to create arrays, as in ‘@[2,4,9,16,25]’.
In such tables, the keys were implicit natural numbers starting at 1.
The form ‘@{}’ was used to create records, as in ‘@{name="John",
age=35}’. Such tables were sets of keyvalue pairs in which the
keys were explicit strings.
Thanks for the correction.
Regards
Dibyendu