From 3366f68792b98747ced4a539846e1786044d91d5 Mon Sep 17 00:00:00 2001 From: gnomerd Date: Fri, 25 Oct 2019 09:07:37 +0200 Subject: [PATCH] Caching stuff --- gamemode/engine/derma/cl_menu.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gamemode/engine/derma/cl_menu.lua b/gamemode/engine/derma/cl_menu.lua index e795e9f..21f627e 100644 --- a/gamemode/engine/derma/cl_menu.lua +++ b/gamemode/engine/derma/cl_menu.lua @@ -16,9 +16,10 @@ Quantum.Client.Menu.GetAPI = function( lib ) return include( libs[lib] ) end net.Receive( "quantum_menu_net", function( len, pl ) local dt = net.ReadTable() -- TO DO: merge datatable with cached ( if same id/type ) if( Quantum.Client.Cache[dt.id] ~= nil && #Quantum.Client.Cache[dt.id] >= 1 ) then - table.Merge( dt, Quantum.Client.Cache[dt.id] ) + table.Merge( Quantum.Client.Cache[dt.id], dt ) + else + Quantum.Client.Cache[dt.id] = dt || { id = dt.id } end - Quantum.Client.Cache[dt.id] = dt || { id = dt.id } if( Quantum.Client.EnableDebug ) then -- debug Quantum.Debug( "Datatable size: " .. len .. "b (" .. len/8 .. "B)" )