News for hackers. Stuff that matters.
Re:Show HN: MicroLua – Lua for the RP2040 Microcontroller by bdowling on Saturday November 04, 2023 @03:37AM (#38138942)
It helps if you realize that there are no arrays in Lua. Instead, everything is an optimized hash map that can be indexed by any value of any type. A single table can have some elements indexed by integers, others indexed by strings, function pointers (useful for a table of debug hooks), etc.

The things that expect tables to be indexed using integers starting at 1 are the # operator to get the number of elements, and the ipairs function, used in the common idiom “for key, value in ipairs(t) do . . . end”.

There are no comments on this comment yet.