lux_lib/lua.rs
1//! Special utilities for the Lua bridge.
2
3use std::sync::OnceLock;
4
5use tokio::runtime::{Builder, Runtime};
6
7pub fn lua_runtime() -> &'static Runtime {
8 static RUNTIME: OnceLock<Runtime> = OnceLock::new();
9 RUNTIME.get_or_init(|| {
10 Builder::new_multi_thread()
11 .enable_all()
12 .build()
13 .expect("Failed to create a new runtime")
14 })
15}