lua-users home
lua-l archive

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

Am Mo., 12. Dez. 2022 um 11:40 Uhr schrieb Buergel, Thomas
> I'm not sure how the OP gets the impression that it behaves in a way such that modification of the loop variable would have any effect.
> A simple test with Lua 5.1 with the REPL:
> > lua
> Lua 5.1.5  Copyright (C) 1994-2012, PUC-Rio
> > for i=1,10 do
> >> print(i)
> >> if i==2 then i=6 print("modified i to ", i) end

ups sorry ... this hits me by surprise ... I could have checked this
myself of course before making such a fuzz here... please excuse...

... I am quite stunned, that somehow here this stack variable i seems
to be readable but not writable... so this is a variable type which I
really would not have expected at all... .

ok ... no more questions, please excuse... .