lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Am So., 11. Dez. 2022 um 12:33 Uhr schrieb Rolf Kalbermatter
> It’s not bizarre at all. Lua may be not a compiler in itself (although there exist JIT versions
> and similar of it) but it’s written in C. And C has the notorious feature of stating many things
> as not being defined for the sake of efficient implementations on all kind of hardware, including
> very esoteric ones.

I have to admit, that I have not any overview how Lua does the for
looping in detail, but I would bet that the for looping in Lua FOR
SURE does NOT rely on any "C Compiler for looping approach". It
typically just should be programmed very similar to the Lua while do
end / repeat until loop, just with this additional counter variable,
which MUST be a "normal Lua" value, so it must reside on Lua stack
"very Lua normally".

After the comments above of Francisco, I interprete it as safe to
interprete the warning in the reference manual more like "It is safe
to vary the counter loop variable inside the for loop limits, but any
new value outside the for loop might lead to undefined behaviour." ...
I hope I will survive this and not run into explosions :).