From 4aa84d879683fc640e43aca287e1f86b4580aa9c Mon Sep 17 00:00:00 2001 From: Deyan Dobromirov Date: Fri, 30 Aug 2024 14:42:41 +0300 Subject: [PATCH] Fixed: `isstring` global being defined two times Added: Timer setup support for multiple types --- lua/autorun/trackassembly_init.lua | 2 +- lua/trackassembly/trackasmlib.lua | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/lua/autorun/trackassembly_init.lua b/lua/autorun/trackassembly_init.lua index 2ffad032..5dd99847 100644 --- a/lua/autorun/trackassembly_init.lua +++ b/lua/autorun/trackassembly_init.lua @@ -86,7 +86,7 @@ local asmlib = trackasmlib; if(not asmlib) then -- Module present ------------ CONFIGURE ASMLIB ------------ asmlib.InitBase("track","assembly") -asmlib.SetOpVar("TOOL_VERSION","8.783") +asmlib.SetOpVar("TOOL_VERSION","8.784") ------------ CONFIGURE GLOBAL INIT OPVARS ------------ diff --git a/lua/trackassembly/trackasmlib.lua b/lua/trackassembly/trackasmlib.lua index 435de76a..a8ec1c7d 100644 --- a/lua/trackassembly/trackasmlib.lua +++ b/lua/trackassembly/trackasmlib.lua @@ -49,8 +49,9 @@ local isbool = isbool local istable = istable local isnumber = isnumber local isstring = isstring -local isstring = isstring local isvector = isvector +local isangle = isangle +local ismatrix = ismatrix local isfunction = isfunction local Vector = Vector local Matrix = Matrix @@ -2656,6 +2657,17 @@ function NewTable(sTable,defTab,bDelete,bReload) tTm[2] = (tonumber(vTm[2] or vTm["Li"]) or 0) -- Record life tTm[3] = ((tonumber(vTm[3] or vTm["Rm"]) or 0) ~= 0) -- Kill command tTm[4] = ((tonumber(vTm[4] or vTm["Co"]) or 0) ~= 0) -- Collect garbage call + elseif(isfunction(vTm)) then -- Transfer table data from definition + local bS, vO = pcall(vTm); if(not bS) then + LogInstance("Generator "..vO,tabDef.Nick); return self end + return self:TimerSetup(vO) -- Force function return value + elseif(isvector(vTm) or isangle(vTm) or ismatrix(vTm)) then + local cA, cB, cC = vTm:Unpack() + tTm[2] = (cA or 0) -- Record life + tTm[3] = ((cB or 0) ~= 0) -- Kill command + tTm[4] = ((cC or 0) ~= 0) -- Collect garbage call + else -- Transfer table data from definition + tTm[2] = (tonumber(vTm) or 0) -- Record life end; return self end -- Navigates the reference in the cache