[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Why no for table-iterator like e. g. "hashpairs"?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Fri, 1 Nov 2019 10:55:06 -0300
> "The order in which the indices are
> enumerated is not specified, even for numeric indices."
>
> ... I just somehow fail to believe this can happen...
For me (using Lua 5.3.5), the code below shows that this can indeed
happen. Run it a few times if needed.
t= { 1, 2, "test", 4, x=5, y= 6}
for n=1,1000 do t[math.random(10)]=n end
for k, v in pairs( t) do print( k, v) end