logoalt Hacker News

junontoday at 1:32 AM1 replyview on HN

The only thing I dislike about Lua is the 1-indexing. I know they had reasons for it but it always caused issues.


Replies

silisilitoday at 7:41 AM

I'm torn on this.

Initially I agreed, just because so many other languages do it that way.

But if you ignore that and clean slate it, IMO, 1 based makes more sense. I feel like 0 based mainly gained foothold because of C's bastardization of arrays vs pointers and associated tricks. But most other languages don't even support that.

You can only see :len(x)-1 so many times before you realize how ridiculous it is.

show 3 replies