[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Order of metatable accesses
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Mon, 16 Nov 2020 19:04:10 -0300
> 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
Which other ordering? It works as advertised: if evaluates c.baz and
d.qux before assigning to b.bar and a.foo.
Oh, you mean the order of the assignments are performed? The manual
purposely avoids saying anything about this; it's just an
You don't need a complicated example. Here is a simpler one:
% cat a
%luac -p -l a
1  GETTABUP 0 0 -3 ; _ENV "c"
2  GETTABUP 1 0 -4 ; _ENV "d"
3  SETTABUP 0 -2 1 ; _ENV "b"
4  SETTABUP 0 -1 0 ; _ENV "a"
which reads: getblobal c, getglobal d, setglobal b, setglobal a.