Ruby support #1

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

View file

@ -111,13 +111,13 @@ macro_rules! impl_tuple {
let system_fn = move |args: In<Vec<RN::Value>>, world: &mut World| { let system_fn = move |args: In<Vec<RN::Value>>, world: &mut World| {
let mut runtime = world.get_resource_mut::<RN>().expect("No runtime resource"); let mut runtime = world.get_resource_mut::<RN>().expect("No runtime resource");
let args = if RN::needs_own_thread() { let args = if RN::needs_own_thread() {
runtime.with_engine_mut(move |engine| { runtime.with_engine_thread_mut(move |engine| {
( (
$($t::from_runtime_value_with_engine(args.get($idx).expect(&format!("Failed to get function argument for index {}", $idx)).clone(), engine), )+ $($t::from_runtime_value_with_engine(args.get($idx).expect(&format!("Failed to get function argument for index {}", $idx)).clone(), engine), )+
) )
}) })
} else { } else {
runtime.with_engine_thread_mut(move |engine| { runtime.with_engine_mut(move |engine| {
( (
$($t::from_runtime_value_with_engine(args.get($idx).expect(&format!("Failed to get function argument for index {}", $idx)).clone(), engine), )+ $($t::from_runtime_value_with_engine(args.get($idx).expect(&format!("Failed to get function argument for index {}", $idx)).clone(), engine), )+
) )

View file

@ -1,6 +1,7 @@
// TODO: install with CC=clang rbenv install 3.4.3 // TODO: install with CC=clang rbenv install 3.4.3
// TODO: adjust rhai examples and docs or maybe more rhai changes to different PR or even better // TODO: adjust rhai examples and docs or maybe more rhai changes to different PR or even better
// find a better way to test them(dont wrap, generic bevy etc) // find a better way to test them(dont wrap, generic bevy etc)
// TODO: Move with_engine_thread and with_engine to 2 separate traits
use std::{ use std::{
collections::HashMap, collections::HashMap,