Installation

Cargo

First you need to install the crate by adding this entry to your Cargo.toml dependencies list:

bevy_mod_scripting = { version = "0.9.0", features = ["lua54"]}

Choose the language features you wish enabled and add them to the features block.

Bevy Plugin

The next step is to add the BMS plugin to your application, on top of any other extras you want included in your app:

app.add_plugins(LuaScriptingPlugin::default());

The above is how you'd setup BMS for Lua, if you want to use another language, simply use a corresponding plugin from the integration crate.

Language Features

Each language supported by BMS can be switched-on via feature flag as below:

LanguageFeature Flag
Lua51lua51
Lua52lua54
Lua53lua53
Lua54lua54
Luajitluajit
Luajit52luajit52
Luauluau
Rhairhai
Runerune

Extra Features

In order to fit as many use cases as possible, BMS allows you to disable a lot of its functionality.

By default all of the useful features are enabled, but you may disable them if you wish if you are only needing BMS for script lifecycle management, and want to populate the bindings yourself.

FeatureDescription
core_functionsIf enabled, will enable all core functions, i.e. bevy integrations which let you interact with Bevy via reflection
bevy_bindingsIf enabled, populates the function registry with additiona automatically generated bevy bindings. This includes functions on glam and bevy::ecs types. These are useful but will slow down compilation considerably.
mlua_asyncEnables mlua/async
mlua_serializeEnables mlua/serialize
mlua_macrosEnables mlua/macros
unsafe_lua_modulesAllows loading unsafe modules via require in lua