On Thu, Nov 15, 2018 at 11:20 PM Dibyendu Majumdar wrote:
Hi, to be honest the for num loop variable should be treated as
'readonly' inside the loop body as it is a copy of the real index
variable, and changing it inside the body doesn't affect the loop, and
is just bad practice in my view.
IMO, it's not a "bad practice".
Mutability of loop variable (without affecting the loop) is quite useful.
for name, value in str:gmatch"(%w+)=(%d+)" do
value = tonumber(value)
for k = 1, 10 do
k = tostring(k)