Update push_userdata_ref

This commit is contained in:
Alex Orlenko 2022-10-09 13:56:30 +01:00
parent cfa959e599
commit e01af22bac
No known key found for this signature in database
GPG key ID: 4C150C250863B96D

View file

@ -2591,6 +2591,7 @@ impl Lua {
pub(crate) unsafe fn push_userdata_ref(&self, lref: &LuaRef) -> Result<Option<TypeId>> {
self.push_ref(lref);
if ffi::lua_getmetatable(self.state, -1) == 0 {
ffi::lua_pop(self.state, 1);
return Err(Error::UserDataTypeMismatch);
}
let mt_ptr = ffi::lua_topointer(self.state, -1);