Repository navigation
v.0.19.6
This version adds the switch statement.
It also allows exposing selected module functions (usually methods) to the global namespace.
This is very convenient when encapsulating the API of a custom Rust type into a module while having methods
and iterators registered on the custom type work normally.
A new gen_fn_signatures API enables enumerating the registered functions of an Engine for documentation purposes.
It also prepares the way for a future reflection API.
Release 0.19.6 released to crates.io.
Bug fixes
- Custom syntax that introduces a shadowing variable now works properly.
Breaking changes
Module::set_fn,Module::set_raw_fnandModule::set_fn_XXX_mutall take an additional parameter ofFnNamespace.Module::set_fntakes a further parameter with a list of parameter names/types plus the function return type, if any.Module::get_sub_module_mutis removed.begin,end,unlessare now reserved keywords.EvalPackageis removed in favor ofEngine::disable_symbol.
New features
- New
switchstatement. - New
do ... whileanddo ... untilstatements. - New
Engine::gen_fn_signatures,Module::gen_fn_signaturesandPackagesCollection::gen_fn_signaturesto generate a list of signatures for functions registered. - New
Engine::register_moduleto register a module as a sub-module in the global namespace. - New
set_exported_global_fn!macro to register a plugin function and expose it to the global namespace. Module::set_fn_XXX_mutcan expose a module function to the global namespace. This is convenient when registering an API for a custom type.Module::set_getter_fn,Module::set_setter_fn,Module::set_indexer_get_fn,Module::set_indexer_set_fnall expose the function to the global namespace by default. This is convenient when registering an API for a custom type.- New
Module::update_fn_metadatato update a module function's parameter names and types. - New
#[rhai_fn(global)]and#[rhai_fn(internal)]attributes to determine whether a function defined in a plugin module should be exposed to the global namespace. This is convenient when defining an API for a custom type. - New
get_fn_metadata_listto get the metadata of all script-defined functions in scope.
Enhancements
- New constants under
DynamicincludingUNIT,TRUE,FALSE,ZERO,ONEetc. - Floating-point numbers ending with a decimal point without a trailing
0are supported.