Metamethod

Noun · Development

Definitions

  1. In Lua, a special function defined in a metatable that overrides default behavior for operations like addition, comparison, indexing, or string conversion on a table.

    In plain English: A special function in Lua that lets you customize what happens when you use operators like + or == on your custom objects.

    Example: "Define __add as a metamethod and suddenly you can add two vectors with the + operator."

Related Terms