[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [ 5.4 ] Sequence Iteration - Knowing when to Stop?
- From: Dirk Laurie <dirk.laurie@...>
- Date: Fri, 1 Jun 2018 21:30:53 +0200
2018-06-01 17:56 GMT+02:00 Russell Haley <email@example.com>:
> Well I've been at this for three years now and it's still a PIA for me and
> all the people that want to see an array data type. I *hate* having to use
> NIL_IN_TABLE seems like a pretty minor compromise for allowing predictable
I've been in Lua, coming from Python, but further back from Pascal,
for seven years. The first two of them I spent lamenting the Python
data structures missing from Lua (i.e. lists, arrays and tuples, Lua
seemed to have only dictionaries). At the same time I gradually
mastered the more advanced features of Lua: metatables, generic
`for`, coroutines. Nowadays, I think in Lua.
On the rare occasions that I can't avoid writing Python, I spend half
of my time in the interactive help and the other half cursing the
non-equivalence of the invisible difference between a tab
and four spaces.
There is nothing involving arrays that you can't do with metatables
except write a table literal that will automatically imply a metatable.
Nobody compels you to use the table library. I have a whole file
of specialized tables: deque, stack, queue, list. An array is just
a special case of a deque, where upper and lower bounds are
But speaking of the table library: I wonder how many people are
using the very powerful 5.3 table.move. And how many people
have noticed the trivial implementation of nil-impervious
table.insert and table.remove that is possible with table.move.