 6726e40768
			
		
	
	
		6726e40768
		
			
		
	
	
	
	
		
			
			* adds Lua language support * makes the library generic, allowing for easy extension for more languages * small improvements and fixes
		
			
				
	
	
		
			21 lines
		
	
	
	
		
			609 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
			
		
		
	
	
			21 lines
		
	
	
	
		
			609 B
		
	
	
	
		
			Rust
		
	
	
	
	
	
| use bevy::prelude::*;
 | |
| use bevy_scriptum::prelude::*;
 | |
| use bevy_scriptum::runtimes::lua::prelude::*;
 | |
| 
 | |
| fn main() {
 | |
|     App::new()
 | |
|         .add_plugins(DefaultPlugins)
 | |
|         .add_scripting::<LuaRuntime>(|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::<LuaScript>::new(
 | |
|         assets_server.load("examples/lua/hello_world.lua"),
 | |
|     ));
 | |
| }
 |