[−][src]Macro rhai_codegen::set_exported_global_fn
set_exported_global_fn!() { /* proc-macro */ }
Macro to register a plugin function into a Rhai Module
and expose it globally.
Usage
use rhai::plugin::*; #[export_fn] fn my_plugin_function(x: i64) -> i64 { x * 2 } let mut engine = Engine::new(); let mut module = Module::new(); set_exported_global_fn!(module, "func", my_plugin_function); engine.register_static_module("test", module.into()); assert_eq!(engine.eval::<i64>("func(21)")?, 42);