Skip to content

Commit 3a5c965

Browse files
authored
Dont store functiondata permanently (#3472)
1 parent ca19d87 commit 3a5c965

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

lua/entities/gmod_wire_expression2/core/extloader.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ if ENT then
5050
ENT = nil
5151

5252
_Msg( "Calling constructors for all Expression 2 chips." )
53-
wire_expression2_prepare_functiondata()
5453
if not args or args[1] ~= "nosend" then
5554
for _, p in player.Iterator() do
5655
if IsValid( p ) then wire_expression2_sendfunctions( p ) end

lua/entities/gmod_wire_expression2/core/init.lua

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,8 @@ if SERVER then
303303
include("extloader.lua")
304304

305305
-- -- Transfer E2 function info to the client for validation and syntax highlighting purposes -- --
306-
307-
local miscdata = {} -- Will contain {E2 types info, constants}, this whole table is under 1kb
308-
local functiondata = {} -- Will contain {functionname = {returntype, cost, argnames, extension}, this will be between 50-100kb
309-
310306
-- Fills out the above two tables
311-
function wire_expression2_prepare_functiondata()
307+
local function getE2FunctionData()
312308
-- Sanitize events so 'listening' e2's aren't networked
313309
local events_sanitized = {}
314310
for evt, data in pairs(E2Lib.Env.Events) do
@@ -325,20 +321,22 @@ if SERVER then
325321
types[typename] = v[1] -- typeid (s)
326322
end
327323

328-
miscdata = { types, wire_expression2_constants, events_sanitized }
329-
functiondata = {}
324+
local miscdata = { types, wire_expression2_constants, events_sanitized }
325+
local functiondata = {}
330326

331327
for signature, v in pairs(wire_expression2_funcs) do
332328
functiondata[signature] = { v[2], v[4], v.argnames, v.extension, v.attributes } -- ret (s), cost (n), argnames (t), extension (s), attributes (t)
333329
end
334-
end
335330

336-
wire_expression2_prepare_functiondata()
331+
return miscdata, functiondata
332+
end
337333

338334
-- Send everything
339335
local function sendData(ply)
340336
if not (IsValid(ply) and ply:IsPlayer()) then return end
341337

338+
local miscdata, functiondata = getE2FunctionData()
339+
342340
local data = WireLib.von.serialize( {
343341
miscdata = miscdata,
344342
functiondata = functiondata

0 commit comments

Comments
 (0)