lua-users home
lua-l archive

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


> What representation will be returned by pairs() and ipairs()?  If I
> assign to t[1.0] may I then expect pairs() and ipairs() to return
> that key as a float?  If I then assign to t[1], will subsequent
> calls to pairs() and ipairs() return that key as a float or an
> integer?

No matter how they are inserted, pairs and next allways return the
integer representation. (ipairs too, but ipairs does not get the keys
from the table; it produces the keys, so they are integers independently
of the table behavior.)

(This should be in the documentation, but I am afraid it is not...)

-- Roberto