Ruby support #1

Open
jaroslaw wants to merge 165 commits from ruby into main
3 changed files with 23 additions and 34 deletions
Showing only changes of commit bf9c94b7f0 - Show all commits

View file

@ -19,7 +19,6 @@
- [Calling Ruby from Rust](./ruby/calling_script_from_rust.md) - [Calling Ruby from Rust](./ruby/calling_script_from_rust.md)
- [Interacting with bevy in callbacks](./ruby/interacting_with_bevy.md) - [Interacting with bevy in callbacks](./ruby/interacting_with_bevy.md)
- [Builtin types](./ruby/builtin_types.md) - [Builtin types](./ruby/builtin_types.md)
- [Builtin variables](./ruby/builtin_variables.md)
- [Rhai](./rhai/rhai.md) - [Rhai](./rhai/rhai.md)
- [Installation](./rhai/installation.md) - [Installation](./rhai/installation.md)
- [Hello World(TBD)]() - [Hello World(TBD)]()

View file

@ -55,6 +55,8 @@ fn set_translation(
## Bevy::Entity ## Bevy::Entity
`Bevy::Entity.current` is currently not available within promise callbacks.
### Constructor ### Constructor
None - instances can only be acquired by using `Bevy::Entity.current` None - instances can only be acquired by using `Bevy::Entity.current`

View file

@ -1,13 +1 @@
# Builtin variables # Builtin variables
## entity
Current entity that the script is atteched to can be retrieved by calling `Bevy::Entity.current`.
It exposes `index` method that returns bevy entity index.
It is useful for accessing entity's components from scripts.
It can be used in the following way:
```ruby
puts("Current entity index: #{Bevy::Entity.current.index}")
```
`Bevy::Entity.current` variable is currently not available within promise callbacks.