News for hackers. Stuff that matters.
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

There are no comments on this comment yet.