Ruby support #1
					 3 changed files with 27 additions and 0 deletions
				
			
		|  | @ -190,6 +190,11 @@ name = "function_return_value_ruby" | |||
| path = "examples/ruby/function_return_value.rs" | ||||
| required-features = ["ruby"] | ||||
| 
 | ||||
| [[example]] | ||||
| name = "hello_world_ruby" | ||||
| path = "examples/ruby/hello_world.rs" | ||||
| required-features = ["ruby"] | ||||
| 
 | ||||
| 
 | ||||
| [dev-dependencies] | ||||
| tracing-subscriber = "0.3.18" | ||||
|  |  | |||
							
								
								
									
										1
									
								
								assets/examples/ruby/hello_world.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								assets/examples/ruby/hello_world.rb
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | |||
| hello_bevy() | ||||
							
								
								
									
										21
									
								
								examples/ruby/hello_world.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								examples/ruby/hello_world.rs
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,21 @@ | |||
| use bevy::prelude::*; | ||||
| use bevy_scriptum::prelude::*; | ||||
| use bevy_scriptum::runtimes::ruby::prelude::*; | ||||
| 
 | ||||
| fn main() { | ||||
|     App::new() | ||||
|         .add_plugins(DefaultPlugins) | ||||
|         .add_scripting::<RubyRuntime>(|runtime| { | ||||
|             runtime.add_function(String::from("hello_bevy"), || { | ||||
|                 println!("hello bevy, called from script"); | ||||
|             }); | ||||
|         }) | ||||
|         .add_systems(Startup, startup) | ||||
|         .run(); | ||||
| } | ||||
| 
 | ||||
| fn startup(mut commands: Commands, assets_server: Res<AssetServer>) { | ||||
|     commands.spawn(Script::<RubyScript>::new( | ||||
|         assets_server.load("examples/ruby/hello_world.rb"), | ||||
|     )); | ||||
| } | ||||
		Loading…
	
		Reference in a new issue