From 13c09bff786eb4e1eb4e4cfbb19a61cc7da8370d Mon Sep 17 00:00:00 2001 From: Deyan Dobromirov Date: Thu, 12 Sep 2024 15:23:18 +0300 Subject: [PATCH] Improved: Reduce memory for indices (1) is the same as (1,2) unique Improved: Make sure to catch bad table column configuration on create --- lua/autorun/trackassembly_init.lua | 8 ++++---- lua/trackassembly/trackasmlib.lua | 6 +++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/lua/autorun/trackassembly_init.lua b/lua/autorun/trackassembly_init.lua index b21bba17..b09d94d5 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.785") +asmlib.SetOpVar("TOOL_VERSION","8.786") ------------ CONFIGURE GLOBAL INIT OPVARS ------------ @@ -1654,7 +1654,7 @@ propertiesAdd(gsOptionsCM, gtOptionsCM) asmlib.NewTable("PIECES",{ Timer = gaTimerSet[1], - Index = {{1},{4},{1,4,Un=true}}, + Index = {{1,4,Un=true}, {4}}, Trigs = { Record = function(arLine, vSrc) local noMD = asmlib.GetOpVar("MISS_NOMD") @@ -1737,7 +1737,7 @@ asmlib.NewTable("PIECES",{ asmlib.NewTable("ADDITIONS",{ Timer = gaTimerSet[2], - Index = {{1},{4},{1,4,Un=true}}, + Index = {{1,4,Un=true}, {4}}, Query = { Record = {"%s","%s","%s","%d","%s","%s","%d","%d","%d","%d","%d","%d"}, ExportDSV = {1,4} @@ -1790,7 +1790,7 @@ asmlib.NewTable("ADDITIONS",{ asmlib.NewTable("PHYSPROPERTIES",{ Timer = gaTimerSet[3], - Index = {{1},{2},{1,2,Un=true}}, + Index = {{1,2,Un=true}, {2}}, Trigs = { Record = function(arLine, vSrc) local noTY = asmlib.GetOpVar("MISS_NOTP") diff --git a/lua/trackassembly/trackasmlib.lua b/lua/trackassembly/trackasmlib.lua index de8ac87b..adc5f619 100644 --- a/lua/trackassembly/trackasmlib.lua +++ b/lua/trackassembly/trackasmlib.lua @@ -3061,7 +3061,11 @@ function NewTable(sTable,defTab,bDelete,bReload) end else nA = qtDef.Size -- When called with no arguments is the same as picking all columns for iCnt = 1, nA do - sStmt = sStmt..qtDef[iCnt][1]..(iCnt ~= nA and ", " or " )") + local tC = qtDef[iCnt]; if(not tC) then + LogInstance("Column missing "..GetReport(nA,iCnt), tabDef.Nick); return self:Deny() end + local sC = tostring(tC[1] or ""); if(IsBlank(sC)) then + LogInstance("Column mismatch "..GetReport(nA,iCnt),tabDef.Nick); return self:Deny() end + sStmt = sStmt..sC..(iCnt ~= nA and ", " or " )") end end; qtCmd[qtCmd.STMT] = sStmt; return self end