[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A know this is a syntactically valid Lua expression.Can someone give me a written parse for it?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Mon, 29 Jul 2019 21:50:58 -0300
> ( a * b ).c()[ d ].e:f()
>
> Other than being a function (method?) call to f, what is the meaning
> of the parse of it, step by step, from left to right?
Here is the output of luac -l -p on that code (Lua 5.1, whose opcodes
has easier to read):
1 [1] GETGLOBAL 0 -1 ; a
2 [1] GETGLOBAL 1 -2 ; b
3 [1] MUL 0 0 1
4 [1] GETTABLE 0 0 -3 ; "c"
5 [1] CALL 0 1 2
6 [1] GETGLOBAL 1 -4 ; d
7 [1] GETTABLE 0 0 1
8 [1] GETTABLE 0 0 -5 ; "e"
9 [1] SELF 0 0 -6 ; "f"
10 [1] CALL 0 2 1