Comment

Comment by otikik

That is absolutely not the case.

Numerical loops in Lua are inclusive:

    for i=1,#t do t[i]=0 end
On the example above the i starts at 1 and goes up to (and including) the length of t.

With 0-based indexes, and that numerical loop format, it would be minus-one everywhere:

    for i=1,#t-1 do ...
parent otikik 14 days ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton