[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Making lua execution results reproducible across architectures
- From: Patrick Rapin <toupie300@...>
- Date: Thu, 15 Dec 2011 08:10:58 +0100
> Can you explain the potential indeterminancy with the length operator a bit
> more, please?
Well, I am not sure it is a problem for you.
The fact is that if for example t={1,2,3,nil,nil,nil,4}, what is #t ?
>From Lua 5.1 manual, the result is not well defined: it can be 3 or 7.
>From Lua 5.2 manual, the result is even undefined.
As an illustration, consider the following snippet. Is there a smart
enough Lua specialist out there who can guess the result of that code
without trying it out ?
for n=2,10 do
local t={}
for i=1,1000 do
if i%n~=0 then t[i] = i end
end
print(#t)
end
But I must admit that the result, although weird, seems perfectly reproducible.