Add Rhai book.

This commit is contained in:
Stephen Chung
2020-06-20 12:06:17 +08:00
parent 7e80d62df5
commit c7f1e12d6a
101 changed files with 3827 additions and 0 deletions

19
doc/src/rust/override.md Normal file
View File

@@ -0,0 +1,19 @@
Override a Built-in Function
===========================
{{#include ../links.md}}
Any similarly-named function defined in a script overrides any built-in or registered
native Rust function of the same name and number of parameters.
```rust
// Override the built-in function 'to_int'
fn to_int(num) {
print("Ha! Gotcha! " + num);
}
print(to_int(123)); // what happens?
```
A registered native Rust function, in turn, overrides any built-in function of the
same name, number and types of parameters.