|
op codes are not an issue at all here; there's still a sequence of opcodes possible to compute RK(C) in a register mapping the expected key from the pair.Even the code "t[1][2]" would also generate a sequence (GETTABLE;SETTABLE) or (GETTABLE,GETTABLE) and not a single opcode...Le dim. 9 déc. 2018 à 20:47, Dibyendu Majumdar <mobile@majumdar.org.uk> a écrit :Hi,
On Sun, 9 Dec 2018 at 18:12, Dirk Laurie <dirk.laurie@gmail.com> wrote:
>
> 1. Is there any syntactic reason why one can't patch Lua so that
> t[1,2] won't raise a compilation error, but instead invoke
> __index(t,1,2) or __newindex(t,1,2,v)?
I think there are issues with the way the table op codes work - and
the number of registers they allow.
GETTABLE A B C R(A) := R(B)[RK(C)]
SETTABLE A B C R(A)[RK(B)] := RK(C)
The opcode doesn't have room for additional registers.
Lua's parsing also assumes that there is a single register for the key.
Regards
Dibyendu