diff --git a/Cargo.toml b/Cargo.toml index 2669d003..496564e6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -58,12 +58,12 @@ libuv = { workspace = true, optional = true } luajit = { workspace = true } macros = { workspace = true, features = ["plugin"] } miniserde = { version = "0.1", optional = true } -mlua = { version = "0.9", features = ["luajit"], optional = true } +mlua = { version = "0.10", features = ["luajit"], optional = true } thiserror = { workspace = true } types = { workspace = true, features = ["serde"] } [dev-dependencies] -mlua = { version = "0.9", features = ["luajit", "module"] } +mlua = { version = "0.10", features = ["luajit", "module"] } serde = { version = "1.0", features = ["derive"] } tokio = { version = "1.0", features = ["full"] } diff --git a/examples/mlua.rs b/examples/mlua.rs index caf389b3..43457241 100644 --- a/examples/mlua.rs +++ b/examples/mlua.rs @@ -5,7 +5,7 @@ use nvim_oxi::{mlua::lua, print, Result}; fn mlua() -> Result<()> { print!("Hello from nvim-oxi.."); let lua = lua(); - let print = lua.globals().get::<_, LuaFunction>("print")?; + let print: LuaFunction = lua.globals().get("print")?; print.call("..and goodbye from mlua!")?; Ok(()) } diff --git a/src/lib.rs b/src/lib.rs index 3ca494ae..9d65b488 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -52,9 +52,9 @@ pub mod mlua { pub use mlua::*; - /// Returns a static reference to a - /// [`mlua::Lua`](https://docs.rs/mlua/latest/mlua/struct.Lua.html) object - /// which can be used to interact with Lua plugins. + /// Returns a + /// [`mlua::Lua`](https://docs.rs/mlua/latest/mlua/struct.Lua.html) + /// instance which can be used to interact with Lua plugins. /// /// # Examples /// @@ -73,10 +73,10 @@ pub mod mlua { /// Ok(()) /// } /// ``` - pub fn lua() -> &'static mlua::Lua { + pub fn lua() -> mlua::Lua { unsafe { luajit::with_state(|lua_state| { - mlua::Lua::init_from_ptr(lua_state as *mut _).into_static() + mlua::Lua::init_from_ptr(lua_state as *mut _) }) } }