Other operators

There are a few miscellaneous meta methods that might be useful. These misc meta methods are mainly focused around string-like operations:

  • __tostringExpected to return a string representation of a table. Takes a single argument, the table being converted to a string.
  • __lenExpected to return the length of the table when writing #table. Takes a single argument, the table whose length we are trying to find.
  • __concatExpected to concatenate two tables when writing table1 .. table2. This function does not have to return a string, but for the sake of consistency it probably should. This function takes two arguments, the tables being concatenated.
..................Content has been hidden....................

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