Hacker News new | past | comments | ask | show | jobs | submit login

Most of the times I use foreach loops like

   for i, x in ipairs(mylist) do
so the 0 vs 1 based indexing is made irrelevant. There are some times where mess up but overall most Lua users don't think its much of an issue. (Personally, I find the lack of a ternary conditional operator much more annoying)



ipairs is deprecated in 5.2, no? What is the alternative?


where'd you get that from? it's not deprecated: http://www.lua.org/manual/5.2/manual.html#8.2



Hmm, weird. It definitely isn't deprecated now, according to the docs[1] and I haven't seen anyone complain about ipairs recently ever since I learned the language ^^. But anyway, the only real downside about ipairs is efficiency so even if they removed it I would probably just add it back myself as a regular function.

[1] http://www.lua.org/manual/5.2/manual.html#pdf-ipairs





Consider applying for YC's Summer 2025 batch! Applications are open till May 13

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

Search: