Add alignment check for userdata
This commit is contained in:
parent
87d25a2205
commit
76eedec62a
|
@ -576,6 +576,8 @@ impl LuaState {
|
|||
|
||||
let ptr = (LUA_SHARED.lua_newuserdata)(*self, std::mem::size_of::<T>()) as *mut T;
|
||||
|
||||
debug_assert_eq!(ptr as usize % std::mem::align_of::<T>(), 0, "Lua userdata is unaligned!");
|
||||
|
||||
if has_metatable {
|
||||
self.push_value(-2);
|
||||
self.set_metatable(-2);
|
||||
|
|
Loading…
Reference in New Issue