aboutsummaryrefslogtreecommitdiff
path: root/docs/metamethods.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/metamethods.md')
-rw-r--r--docs/metamethods.md8
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/metamethods.md b/docs/metamethods.md
index 8ab2be43..dbd11069 100644
--- a/docs/metamethods.md
+++ b/docs/metamethods.md
@@ -3,25 +3,25 @@
This language relies on a small set of "metamethods" which define special
behavior that is required for all types:
-- `as_text(obj:&(optional)T, colorize=no, type:&TypeInfo_t)->Text`: a method to
+- `func as_text(obj:&(optional)T, colorize=no, type:&TypeInfo_t -> Text)`: a method to
convert the type to a string. If `colorize` is `yes`, then the method should
include ANSI escape codes for syntax highlighting. If the `obj` pointer is
`NULL`, a string representation of the type will be returned instead.
-- `compare(x:&T, y:&T, type:&TypeInfo_t)->Int32`: Return an integer representing
+- `func compare(x:&T, y:&T, type:&TypeInfo_t -> Int32)`: Return an integer representing
the result of comparing `x` and `y`, where negative numbers mean `x` is less
than `y`, zero means `x` is equal to `y`, and positive numbers mean `x` is
greater than `y`. For the purpose of floating point numbers, `NaN` is sorted
as greater than any other number value and `NaN` values are compared bitwise
between each other.
-- `equals(x:&T, y:&T, type:&TypeInfo_t)->Bool`: This is the same as comparing two
+- `func equals(x:&T, y:&T, type:&TypeInfo_t -> Bool)`: This is the same as comparing two
numbers to check for zero, except for some minor differences: floating point
`NaN` values are _not_ equal to each other (IEEE 754) and the implementation
of `equals` may be faster to compute than `compare` for certain types, such
as tables.
-- `hash(x:&T, type:&TypeInfo_t)->Int32`: Values are hashed when used as keys in a
+- `func hash(x:&T, type:&TypeInfo_t -> Int32)`: Values are hashed when used as keys in a
table or set. Hashing is consistent with equality, so two values that are
equal _must_ hash to the same hash value, ideally in a way that makes it
unlikely that two different values will have the same hash value.