Log In  


according to the manual:

 A += 2   -- EQUIVALENT TO: A = A + 2

// note that the LHS appears twice, so for TBL[FN()]+=1, FN() will be called twice.

ok, let's test it:

 function fn()
   print("in function")
   return 1
 end

 f={ 10 }
 print("f[1] is "..f[1]) 
 f[fn()]+=1
 print("f[1] is "..f[1])

the function fn is only called once!

1


Good catch! The warning is obsolete as of a couple of builds back, when @zep turned += from a macro into a proper assignment operator.



[Please log in to post a comment]