Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

They don't have to, since Lua tables are hash sets and you can use anything as a key. You can start them at 0 if you want. table[0] = "foo" is valid and works. The downside is you have to add '-1' in a few places, but it's not as many as you'd think. All of my Lua code uses zero based arrays. I think the only place I had to add -1 was initializing numeric for loops.


Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: