[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Why no for table-iterator like e. g. "hashpairs"?
- From: bil til <flyer31@...>
- Date: Fri, 1 Nov 2019 04:38:14 -0700 (MST)
THank you for your answer.
Yes I understand, in the manula it says "The order in which the indices are
enumerated is not specified, even for numeric indices."
... I just somehow fail to believe this can happen...
I just tried the following table in lua:
t= { 1, 2, "test", 4, x=5, y= 6}
for k, v in pairs( t) do
print( k, v)
end
The resulting printout ALWAYS gives the index/list part of the table (1, 2,
"test", 4) in CORRECT order ... only the hashed x and y can appear in
reversed order.
This is what I would also from the lua c code ... mixing up the list part of
the table I think is nearly impossible. Possibly this Reference manual
warning is only some "historic warning" which is a remainder from some
previous lua versions, where the indexed part had not been organized as
linear array?
--
Sent from: http://lua.2524044.n2.nabble.com/Lua-l-f2524044.html