Skip to content

Commit

Permalink
Merge pull request #190 from replcat/mlua-0.10
Browse files Browse the repository at this point in the history
deps: update `mlua` to `0.10`
  • Loading branch information
noib3 authored Nov 1, 2024
2 parents 2fc7313 + 0e3be18 commit e9c43e9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }

Expand Down
2 changes: 1 addition & 1 deletion examples/mlua.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand All @@ -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 _)
})
}
}
Expand Down

0 comments on commit e9c43e9

Please sign in to comment.