lua-users home
lua-l archive

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

Em qua., 11 de nov. de 2020 às 21:02, Spar <> escreveu:
Because older versions of Lua had more strict scopes.
If you try to run this script in Lua 1.0 (Up to Lua 2.1) it will error:
local i = 123
    local I = 321
    print(i, I)
    i = i + 1
until i > 1000

lua: unexpected type at conversion to number
        in statement begining at line 6 of file "benchmark.lua"

Since I test Lua VM and not trying to squeeze the performance I decided to preserve it as global for the entire benchmark. Am I wrong with this statement?
Of course not.
But local i, favors 5.4.
In my tests, makes 0.054s

Ranier Vilela