News for hackers. Stuff that matters.
Re:Lua, a Misunderstood Language (2021) by tromp on Thursday September 29, 2022 @02:42PM (#33025267)
> "what is the index of the last item?" 5

Usually, the more interesting question is:

What is the index of the next item (when extending the array)? Which is 5 in 0-based indexing.

Re:Lua, a Misunderstood Language (2021) by shoemakersteve on Thursday September 29, 2022 @05:13PM (#33027300)
Is it? If you're doing low-level stuff maybe, but I really haven't done much of that so I'm not even sure I know what you mean by "extending" an array (presumably has something to do with allocating contiguous memory?) and I can't actually think of any situation off the top of my head where I would ever need "the last index + 1" what with array methods existing and all.