lua-users home
lua-l archive

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

The reason I went for making mcall return the function and its first parameter had to do with the underlying behavior of the Lua virtual machine and with the needs for implementing method curries. If we insist that the SELF opcode always generates the object to call and the first parameter to the call, then everything after that is well positioned for reasoning about the state of the stack for a call or for building a method curry. The __mcall metatable entry is basically a way to override this behavior. We could say that it only gets to return the item to call, but that seems overly restrictive.