lua-users home
lua-l archive

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

On Mon, 16 Nov 2020 at 22:04, Luiz Henrique de Figueiredo
<> wrote:
> > But the only thing I see in the
> > manual is "The assignment statement first evaluates all its
> > expressions and only then the assignments are performed." Should the
> > manual make a stronger statement, or is what it says all that's
> > guaranteed and the other ordering I noticed just an implementation
> > detail?
> Which other ordering? It works as advertised: if evaluates c.baz and
> d.qux before assigning to and
> Oh, you mean the order of the assignments are performed? The manual
> purposely avoids saying anything about this; it's just an
> implementation detail.

That's interesting. I thought there was a reason for right to left assignment.

I think the implementation is slightly more complex than the manual
states... if I recall correctly:

The LHS expressions are evaluated first but not resolved (because we
don't know if it is load or store on tables)
Then the RHS expressions are evaluated and values stored in temporaries?
Finally the LHS expressions are assigned values from the temporaries
(right to left).