Math operators

All of the following are binary mathematical operators. The meta method for each of these operators takes two arguments, the left- and the right-hand side of the equation. Each of the functions takes the following general form:

meta = {
__<method> = function(left, right)
-- Do stuff
end
}

Here are the names and a brief description of each binary mathematical meta method:

  • __addAddition, when writing "table + object" or "object + table"
  • __subSubtraction, when writing "table - object" or "object - table"
  • __mul: Multiplication, when writing "table * object" or "object * table"
  • __divDivision, when writing "table / object" or "object / table"
  • __modModulo, when writing "table % object" or "object % table"
  • __powInvolution, when writing "table ^ object" or "object ^ table"
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.219.249.210