News for hackers. Stuff that matters.
Re:What's New in Lua 5.4 by saagarjha on Wednesday July 15, 2020 @09:44PM (#23854823)
> To mark a node at the third position, containing one character, we say {3,3}. > But what if there's a node at the third position, that contains no character? Well, thats {3,2}

Why not shift over indexing by one consistently? So you'd use {3, 4} and {3, 3} for each, so the length property is preserved.

Re:What's New in Lua 5.4 by samatman on Wednesday July 15, 2020 @10:07PM (#23854965)
Because that's not how the string library works.

("12345"):sub(3,3) returns "3", while ("12345"):sub(3,4) returns "34", and ("12345"):sub(3,2) returns "".

Indexing in the array portion of tables, and strings, is at least consistent; but Djikstra was right.

The Wiki[0] has a good discussion of Djikstra's iconic essay. The best of these arguments, imho: 0 based indexing unifies enumeration and measurement.

[0]: https://wiki.c2.com/?WhyNumberingShouldStartAtZero