Re: Table enumeration order with integer indices
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Table enumeration order with integer indices
- From: Roberto Ierusalimschy <roberto@...>
- Date: 2023年8月17日 09:45:25 -0300
> The preconditions to operate a table :
> - the same lua version
> - the table has no metatable
> - only integer indices in the table
> - the same operations(only insert or remove) and operation order to a table
>
> For example, the pairs(t) and pairs(t2) produce the same enumeration.
>
> So with these same preconditions to operate a table, will pairs(t) produce
> the same enumeration?
Yes.
> If the answer is yes, Is it possible to make it landing on lua
> document(for `next` document) ?
No. As Fransisco already pointed out, that would limit our
implementation options to little gain. For instance, in the past all
that was true for string indices too, until it wasn't.
-- Roberto