lua-users home
lua-l archive

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


Can confirm this issue exists in Lua 5.3.5 as well (test.lua is the same as program.lua above):

$ time lua test.lua 1
Array indices start with 1

real 0m0.145s
user 0m0.129s
sys 0m0.012s
$ time lua test.lua 0
Array indices start with 0

real 7m22.883s
user 7m22.836s
sys 0m0.025s

On Mon, Nov 23, 2020 at 10:20 AM Oliver Kroth <oliver.kroth@nec-i.de> wrote:
Try adding

       game_field[0] ="green"

before

initialize_game_field()

and call your script with argument 1...

With that change to the above program, I get (using the same Lua on the same computer):

$ time lua test.lua 1
Array indices start with 1

real 7m38.496s
user 7m38.243s
sys 0m0.076s

Definitely seems to be an issue with assigning to index 0. 3,000 times slower is highly unexpected and should be considered a bug IMO.