Closed jgray-19 closed 1 year ago
So RFOR(j,m.snm-(i+1)) means that we do the same number of loops as Lua.
The outer for loop is equivalent to
for i = snm-1, 0, -1 do
meaning i
is initially one less than in Lua, but does the same number of iterations
The inner for loop becomes then
for j = snm - 1 - i, 0, -1 do
The -1 in the j
loop accounts for the fact you go to 0 (compared to lua going to 1), but because i
is 1 less compared to lua, you need to account for this fact.
Therefore
for j = snm - 1 - (i+1), 0, -1 do
accounts for i
being smaller.