|
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