Comment

Comment by int_19h

> Why are arrays tables

For the same reason why (standard) arrays are associative in PHP and JS, as well - because, from a certain perspective, a regular array is just an associated array with consecutive integers as keys, so if you're trying to keep things simple, it seems like a straightforward unification.

> why are they nil terminated

It follows from them being associated arrays, and Lua's pervasive use of "nil" meaning "this thing is missing".

> why do they start at 1

Because humans generally start counting from 1.

parent int_19h 1 year ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton