diff --git a/gmod/src/lua/lua_state.rs b/gmod/src/lua/lua_state.rs index 0071b94..5a18173 100644 --- a/gmod/src/lua/lua_state.rs +++ b/gmod/src/lua/lua_state.rs @@ -576,6 +576,8 @@ impl LuaState { let ptr = (LUA_SHARED.lua_newuserdata)(*self, std::mem::size_of::()) as *mut T; + debug_assert_eq!(ptr as usize % std::mem::align_of::(), 0, "Lua userdata is unaligned!"); + if has_metatable { self.push_value(-2); self.set_metatable(-2);