Make tables casing consistent.
This commit is contained in:
@@ -37,7 +37,7 @@ The following methods (mostly defined in the [`BasicArrayPackage`][packages] but
|
||||
| `append` | array to append | concatenates the second array to the end of the first |
|
||||
| `+=` operator | array, array to append | concatenates the second array to the end of the first |
|
||||
| `+` operator | first array, second array | concatenates the first array with the second |
|
||||
| `insert` | element to insert, position<br/>(beginning if <= 0, end if >= length) | insert an element at a certain index |
|
||||
| `insert` | element to insert, position<br/>(beginning if <= 0, end if >= length) | inserts an element at a certain index |
|
||||
| `pop` | _none_ | removes the last element and returns it ([`()`] if empty) |
|
||||
| `shift` | _none_ | removes the first element and returns it ([`()`] if empty) |
|
||||
| `remove` | index | removes an element at a particular index and returns it, or returns [`()`] if the index is not valid |
|
||||
@@ -52,7 +52,7 @@ Use Custom Types With Arrays
|
||||
---------------------------
|
||||
|
||||
To use a [custom type] with arrays, a number of array functions need to be manually implemented,
|
||||
in particular `push`, `pad` and the `+=` operator. In addition, the `==` operator must be
|
||||
in particular `push`, `insert`, `pad` and the `+=` operator. In addition, the `==` operator must be
|
||||
implemented for the [custom type] in order to support the `in` operator which uses `==` to
|
||||
compare elements.
|
||||
|
||||
|
@@ -17,8 +17,8 @@ In general, there are two types of _namespaces_ where functions are looked up:
|
||||
|
||||
| Namespace | Source | Lookup method | How Many |
|
||||
| --------- | ---------------------------------------------------------------------- | --------------------------------- | :----------------------: |
|
||||
| Global | `Engine::register_XXX` API, [`AST`] being evaluated, [packages] loaded | Simple function name | One |
|
||||
| Module | [`Module`] | Namespace-qualified function name | As many as [`import`]-ed |
|
||||
| Global | `Engine::register_XXX` API, [`AST`] being evaluated, [packages] loaded | simple function name | one |
|
||||
| Module | [`Module`] | namespace-qualified function name | as many as [`import`]-ed |
|
||||
|
||||
|
||||
Global Namespace
|
||||
|
@@ -7,19 +7,19 @@ The following are reserved keywords in Rhai:
|
||||
|
||||
| Active keywords | Reserved keywords | Usage | Inactive under feature |
|
||||
| ------------------------------------------------- | ------------------------------------------------ | --------------------- | :--------------------: |
|
||||
| `true`, `false` | | Boolean constants | |
|
||||
| `let`, `const` | `var`, `static` | Variable declarations | |
|
||||
| `is_shared` | | Shared values | [`no_closure`] |
|
||||
| `if`, `else` | `then`, `goto`, `exit` | Control flow | |
|
||||
| | `switch`, `match`, `case` | Matching | |
|
||||
| `while`, `loop`, `for`, `in`, `continue`, `break` | `do`, `each` | Looping | |
|
||||
| `fn`, `private` | `public`, `new` | Functions | [`no_function`] |
|
||||
| `return` | | Return values | |
|
||||
| `throw` | `try`, `catch` | Throw exceptions | |
|
||||
| `import`, `export`, `as` | `use`, `with`, `module`, `package` | Modules/packages | [`no_module`] |
|
||||
| `Fn`, `call`, `curry` | | Function pointers | |
|
||||
| | `spawn`, `go`, `sync`, `async`, `await`, `yield` | Threading/async | |
|
||||
| `type_of`, `print`, `debug`, `eval` | | Special functions | |
|
||||
| | `default`, `void`, `null`, `nil` | Special values | |
|
||||
| `true`, `false` | | boolean constants | |
|
||||
| `let`, `const` | `var`, `static` | variable declarations | |
|
||||
| `is_shared` | | shared values | [`no_closure`] |
|
||||
| `if`, `else` | `then`, `goto`, `exit` | control flow | |
|
||||
| | `switch`, `match`, `case` | matching | |
|
||||
| `while`, `loop`, `for`, `in`, `continue`, `break` | `do`, `each` | looping | |
|
||||
| `fn`, `private` | `public`, `new` | functions | [`no_function`] |
|
||||
| `return` | | return values | |
|
||||
| `throw` | `try`, `catch` | throw exceptions | |
|
||||
| `import`, `export`, `as` | `use`, `with`, `module`, `package` | modules/packages | [`no_module`] |
|
||||
| `Fn`, `call`, `curry` | | function pointers | |
|
||||
| | `spawn`, `go`, `sync`, `async`, `await`, `yield` | threading/async | |
|
||||
| `type_of`, `print`, `debug`, `eval` | | special functions | |
|
||||
| | `default`, `void`, `null`, `nil` | special values | |
|
||||
|
||||
Keywords cannot become the name of a [function] or [variable], even when they are disabled.
|
||||
|
@@ -45,11 +45,11 @@ Boolean operators
|
||||
|
||||
| Operator | Description |
|
||||
| ----------------- | ------------------------------------- |
|
||||
| `!` | Boolean _Not_ |
|
||||
| `&&` | Boolean _And_ (short-circuits) |
|
||||
| <code>\|\|</code> | Boolean _Or_ (short-circuits) |
|
||||
| `&` | Boolean _And_ (doesn't short-circuit) |
|
||||
| <code>\|</code> | Boolean _Or_ (doesn't short-circuit) |
|
||||
| `!` | boolean _Not_ |
|
||||
| `&&` | boolean _And_ (short-circuits) |
|
||||
| <code>\|\|</code> | boolean _Or_ (short-circuits) |
|
||||
| `&` | boolean _And_ (doesn't short-circuit) |
|
||||
| <code>\|</code> | boolean _Or_ (doesn't short-circuit) |
|
||||
|
||||
Double boolean operators `&&` and `||` _short-circuit_, meaning that the second operand will not be evaluated
|
||||
if the first one already proves the condition wrong.
|
||||
|
@@ -49,7 +49,7 @@ The following table illustrates the differences:
|
||||
|
||||
| Function type | Parameters | Object reference | Function signature |
|
||||
| :-----------: | :--------: | :--------------------: | :-----------------------------------------------------: |
|
||||
| Native Rust | _n_ + 1 | First `&mut` parameter | `fn method<T, U, V>`<br/>`(obj: &mut T, x: U, y: V) {}` |
|
||||
| Native Rust | _n_ + 1 | first `&mut` parameter | `fn method<T, U, V>`<br/>`(obj: &mut T, x: U, y: V) {}` |
|
||||
| Rhai script | _n_ | `this` | `fn method(x, y) {}` |
|
||||
|
||||
|
||||
|
@@ -9,10 +9,10 @@ Integer Functions
|
||||
The following standard functions (defined in the [`BasicMathPackage`][packages] but excluded if using a [raw `Engine`])
|
||||
operate on `i8`, `i16`, `i32`, `i64`, `f32` and `f64` only:
|
||||
|
||||
| Function | No available under | Description |
|
||||
| -------- | :----------------: | ---------------------------------------------------------------------- |
|
||||
| `abs` | | absolute value |
|
||||
| `sign` | | return -1 (`INT`) if the number is negative, +1 if positive, 0 if zero |
|
||||
| Function | No available under | Description |
|
||||
| -------- | :----------------: | ----------------------------------------------------------------------- |
|
||||
| `abs` | | absolute value |
|
||||
| `sign` | | returns -1 (`INT`) if the number is negative, +1 if positive, 0 if zero |
|
||||
|
||||
|
||||
Floating-Point Functions
|
||||
@@ -39,8 +39,8 @@ Conversion Functions
|
||||
The following standard functions (defined in the [`BasicMathPackage`][packages] but excluded if using a [raw `Engine`])
|
||||
parse numbers:
|
||||
|
||||
| Function | No available under | Description |
|
||||
| --------------- | :----------------: | -------------------------------------------------- |
|
||||
| [`to_float`] | [`no_float`] | convert an integer type to `FLOAT` |
|
||||
| [`parse_int`] | | convert a [string] to `INT` with an optional radix |
|
||||
| [`parse_float`] | [`no_float`] | convert a [string] to `FLOAT` |
|
||||
| Function | No available under | Description |
|
||||
| --------------- | :----------------: | --------------------------------------------------- |
|
||||
| [`to_float`] | [`no_float`] | converts an integer type to `FLOAT` |
|
||||
| [`parse_int`] | | converts a [string] to `INT` with an optional radix |
|
||||
| [`parse_float`] | [`no_float`] | converts a [string] to `FLOAT` |
|
||||
|
@@ -10,8 +10,8 @@ Unary Operators
|
||||
|
||||
| Operator | Description |
|
||||
| -------- | ----------- |
|
||||
| `+` | Positive |
|
||||
| `-` | Negative |
|
||||
| `+` | positive |
|
||||
| `-` | negative |
|
||||
|
||||
```rust
|
||||
let number = -5;
|
||||
@@ -24,17 +24,17 @@ Binary Operators
|
||||
|
||||
| Operator | Description | Integers only |
|
||||
| --------------- | ---------------------------------------------------- | :-----------: |
|
||||
| `+` | Plus | |
|
||||
| `-` | Minus | |
|
||||
| `*` | Multiply | |
|
||||
| `/` | Divide (integer division if acting on integer types) | |
|
||||
| `%` | Modulo (remainder) | |
|
||||
| `~` | Power | |
|
||||
| `&` | Bit-wise _And_ | Yes |
|
||||
| <code>\|</code> | Bit-wise _Or_ | Yes |
|
||||
| `^` | Bit-wise _Xor_ | Yes |
|
||||
| `<<` | Left bit-shift | Yes |
|
||||
| `>>` | Right bit-shift | Yes |
|
||||
| `+` | plus | |
|
||||
| `-` | minus | |
|
||||
| `*` | multiply | |
|
||||
| `/` | divide (integer division if acting on integer types) | |
|
||||
| `%` | modulo (remainder) | |
|
||||
| `~` | power | |
|
||||
| `&` | bit-wise _And_ | Yes |
|
||||
| <code>\|</code> | bit-wise _Or_ | Yes |
|
||||
| `^` | bit-wise _Xor_ | Yes |
|
||||
| `<<` | left bit-shift | Yes |
|
||||
| `>>` | right bit-shift | Yes |
|
||||
|
||||
```rust
|
||||
let x = (1 + 2) * (6 - 4) / 2; // arithmetic, with parentheses
|
||||
|
Reference in New Issue
Block a user