lua-users home
lua-l archive

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


> OP_MMBIN - invokes metamethod denoted by the index in C (enum TMS) with
> R[A] and R[B] as parameters. If there is a metamethod, is the result
> placed in the result register of the previous arithmetic instruction?
> The same goes for OP_MMBINI and OP_MMBINK I assume, is that correct? 

Yes.


> OP_MMBINI and OP_MMBINK - similar to OP_MMBIN, but on an integer (SB) or
> constant (K[B]), am I correct about that? 

Yes.


> What is the significance of K in OP_MMBINI and OP_MMBINK? Is it to just
> flip the two parameters to the metamethod?  

Yes. It means the parameters were flipped when generating the opcodes,
assuming the operation was commutative (plus, mul, band, etc.). As we
cannot assume metamethods are commutative, 'k' flips them back to the
original format.


> In summary, I assume these instructions (judging by the source code) try
> to invoke a metamethod indicated by C and put the result in the R(A of
> previous instruction) if the call could happen, where K indicates
> whether the parameters to the methamethod should be flipped or not. 

Yes.

-- Roberto
_______________________________________________
lua-l mailing list -- lua-l@lists.lua.org
To unsubscribe send an email to lua-l-leave@lists.lua.org