private static void InternalPushNet(IntPtr state, object obj, string metatable) { var handle = GCHandle.Alloc(obj, GCHandleType.Normal); LuaApi.PushHandle(state, handle); LuaApi.GetField(state, LuaApi.RegistryIndex, metatable); LuaApi.SetMetatable(state, -2); }