lux_lib/lua.rs
1//! Special utilities for the Lua bridge.
2
3use tokio::runtime::{Builder, Runtime};
4
5use lazy_static::lazy_static;
6
7lazy_static! {
8 static ref LUA_RUNTIME: Runtime = {
9 let span = tracing::debug_span!("Initialising Lua runtime");
10 let _enter = span.enter();
11 #[allow(clippy::expect_used)]
12 Builder::new_multi_thread()
13 .enable_all()
14 .build()
15 .expect("Failed to initialise Lua runtime")
16 };
17}
18
19pub fn lua_runtime() -> &'static Runtime {
20 &LUA_RUNTIME
21}