Skip to content

Commit

Permalink
Fix Lua::set_vector_metatable
Browse files Browse the repository at this point in the history
  • Loading branch information
khvzak committed Jul 2, 2024
1 parent e3d138d commit a176ec7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lua.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1739,8 +1739,9 @@ impl Lua {
#[cfg(any(all(feature = "luau", feature = "unstable"), doc))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "luau", feature = "unstable"))))]
pub fn set_vector_metatable(&self, metatable: Option<Table>) {
let lua = self.lock();
unsafe {
let state = self.state();
let state = lua.state();
let _sg = StackGuard::new(state);
assert_stack(state, 2);

Expand All @@ -1749,7 +1750,7 @@ impl Lua {
#[cfg(feature = "luau-vector4")]
ffi::lua_pushvector(state, 0., 0., 0., 0.);
match metatable {
Some(metatable) => self.push_ref(&metatable.0),
Some(metatable) => lua.push_ref(&metatable.0),
None => ffi::lua_pushnil(state),
};
ffi::lua_setmetatable(state, -2);
Expand Down

0 comments on commit a176ec7

Please sign in to comment.