diff options
Diffstat (limited to 'core/result.moon')
| -rw-r--r-- | core/result.moon | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/core/result.moon b/core/result.moon index cf228ec..6c994cb 100644 --- a/core/result.moon +++ b/core/result.moon @@ -12,17 +12,25 @@ class Result --- return whether this Result's value is const. is_const: => not next @side_inputs - --- assert value-constness and returns the value. + --- assert value-constness and return the value. -- @tparam[opt] string msg the error message to throw + -- @treturn any const: (msg) => assert not (next @side_inputs), msg or "eval-time const expected" @value - --- assert this result has a value, returns its type. + --- assert this result has a value, return its type. + -- @treturn string type: => assert @value, "Result with value expected" @value.type + --- assert this result has a value, returns its metatype. + -- @treturn string `"value"` or `"event"` + metatype: => + assert @value, "Result with value expected" + @value.metatype + --- create a copy of this result with value-copy semantics. -- the copy has the same @value and @side_inputs, but will not update -- anything on \tick. |
