lua-users home
lua-l archive

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


If that's the case, the deprecated table.setn wouldn't help to do this in just one call ? Was it wise to deprecate it ?

2007/6/6, Roberto Ierusalimschy < roberto@inf.puc-rio.br>:
> I believe the difference is because I made 'composite' an array with
> contiguous numerical indexes, with optimized access in Lua 5.1 (direct
> offset computing), while in the previous code, Lua probably has to make
> more complex tests (hashing the index?) to see if the slot is empty.

This is my guess, too. You can check by initializing the "prime" array
with falses before starting the sieve (as you do with 'composite').

-- Roberto