lua-users home
lua-l archive

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


Dirk Laurie wrote:

A new operator requires a new metamethod. Suggestion:

__divmod(op1, op2)
    Returns two results: quotient and remainder.

Semantics exactly as for other functions with multiple return values.
Only the first return value is kept in expressions, list constructors
except for the last item, etc.

This definition screams for the symbol `/%`.

q, r = 42 /% 10  -->  4,2

That's so .... forthlike :-)

Ralph