Bump version to 0.10.1.
This commit is contained in:
parent
710a07d896
commit
318bf97986
@ -1,8 +1,8 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "rhai"
|
name = "rhai"
|
||||||
version = "0.10.0-alpha1"
|
version = "0.10.1"
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
authors = ["Jonathan Turner", "Lukáš Hozda"]
|
authors = ["Jonathan Turner", "Lukáš Hozda", "Stephen Chung"]
|
||||||
description = "Embedded scripting for Rust"
|
description = "Embedded scripting for Rust"
|
||||||
homepage = "https://github.com/jonathandturner/rhai"
|
homepage = "https://github.com/jonathandturner/rhai"
|
||||||
repository = "https://github.com/jonathandturner/rhai"
|
repository = "https://github.com/jonathandturner/rhai"
|
||||||
|
32
README.md
32
README.md
@ -19,10 +19,19 @@ You can install Rhai using crates by adding this line to your dependencies:
|
|||||||
|
|
||||||
```toml
|
```toml
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rhai = "0.10.0-alpha1"
|
rhai = "0.10.0"
|
||||||
```
|
```
|
||||||
|
|
||||||
Beware that to use pre-releases (alpha and beta) you need to specify the exact version in your `Cargo.toml`.
|
or simply:
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[dependencies]
|
||||||
|
rhai = "*"
|
||||||
|
```
|
||||||
|
|
||||||
|
to use the latest version.
|
||||||
|
|
||||||
|
Beware that in order to use pre-releases (alpha and beta) you need to specify the exact version in your `Cargo.toml`.
|
||||||
|
|
||||||
## Related
|
## Related
|
||||||
|
|
||||||
@ -206,6 +215,19 @@ fn main() {
|
|||||||
|
|
||||||
You can also see in this example how you can register multiple functions (or in this case multiple instances of the same function) to the same name in script. This gives you a way to overload functions and call the correct one, based on the types of the arguments, from your script.
|
You can also see in this example how you can register multiple functions (or in this case multiple instances of the same function) to the same name in script. This gives you a way to overload functions and call the correct one, based on the types of the arguments, from your script.
|
||||||
|
|
||||||
|
# Override built-in functions
|
||||||
|
|
||||||
|
Any similarly-named function defined in a script with the correct argument types overrides any built-in function.
|
||||||
|
|
||||||
|
```rust
|
||||||
|
// Override the built-in function 'to_int'
|
||||||
|
fn to_int(num) {
|
||||||
|
print("Ha! Gotcha!" + num);
|
||||||
|
}
|
||||||
|
|
||||||
|
print(to_int(123)); // what will happen?
|
||||||
|
```
|
||||||
|
|
||||||
# Custom types and methods
|
# Custom types and methods
|
||||||
|
|
||||||
Here's an more complete example of working with Rust. First the example, then we'll break it into parts:
|
Here's an more complete example of working with Rust. First the example, then we'll break it into parts:
|
||||||
@ -477,7 +499,7 @@ fn add(x, y) {
|
|||||||
print(add(2, 3))
|
print(add(2, 3))
|
||||||
```
|
```
|
||||||
|
|
||||||
To return a `Dynamic` value, simply box it and return it.
|
To return a `Dynamic` value, simply `Box` it and return it.
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
fn decide(yes_no: bool) -> Dynamic {
|
fn decide(yes_no: bool) -> Dynamic {
|
||||||
@ -543,7 +565,9 @@ print(y.len()); // prints 0
|
|||||||
your own custom type, you need to define a specific override:
|
your own custom type, you need to define a specific override:
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
engine.register_fn("push", |list: &mut rhai::Array, item: MyType| list.push(Box::new(item)));
|
engine.register_fn("push",
|
||||||
|
|list: &mut Array, item: MyType| list.push(Box::new(item))
|
||||||
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
The type of a Rhai array is `rhai::Array`.
|
The type of a Rhai array is `rhai::Array`.
|
||||||
|
4
TODO
4
TODO
@ -1,11 +1,7 @@
|
|||||||
pre 1.0:
|
pre 1.0:
|
||||||
- binary ops
|
|
||||||
- basic threads
|
- basic threads
|
||||||
- stdlib
|
- stdlib
|
||||||
- floats
|
|
||||||
- REPL (consume functions)
|
|
||||||
1.0:
|
1.0:
|
||||||
- decide on postfix/prefix operators
|
- decide on postfix/prefix operators
|
||||||
- ranges, rustic for-loop
|
|
||||||
- advanced threads + actors
|
- advanced threads + actors
|
||||||
- more literals
|
- more literals
|
||||||
|
Loading…
Reference in New Issue
Block a user