Behaviour

The tag method called for an event is selected according to the tag of the values involved in the event. The return value of the tag method that is called becomes the result of the event.

The handling of tag methods degrades gracefully, either by providing some default behaviour for events dealing with normal data types, or by calling the error function if no valid tag method could be selected for the event.

The following describes the selectionmethod for tagmethods for eventswith two operands (binary operations): First, Lua tries the first operand. If its tag does not define a tagmethod for the operation, then Lua tries the second operand. If it also fails, then it gets a tag method from tag 0.