From e9fd3921a6f05a91b882ad2e54b681375b10ab5f Mon Sep 17 00:00:00 2001 From: dutchie031 Date: Sun, 20 Sep 2026 15:49:41 +0200 Subject: [PATCH] updated for LuaLS findings --- .luarc.json | 3 ++- src/classes/configuration/CapConfig.lua | 4 ++++ src/classes/persistence/Persistence.lua | 9 +++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.luarc.json b/.luarc.json index bbb66c5..d7c6e39 100644 --- a/.luarc.json +++ b/.luarc.json @@ -6,7 +6,8 @@ "workspace": { "checkThirdParty": false, "maxPreload": 1600, - "preloadFileSize": 1000 + "preloadFileSize": 1000, + "ignoreDir": [ "config.lua" ] }, "diagnostics": { "enable": true, diff --git a/src/classes/configuration/CapConfig.lua b/src/classes/configuration/CapConfig.lua index cd81a3f..3984c0a 100644 --- a/src/classes/configuration/CapConfig.lua +++ b/src/classes/configuration/CapConfig.lua @@ -21,6 +21,10 @@ function CapConfig.new() if SpearheadConfig == nil then SpearheadConfig = {} end if SpearheadConfig.CapConfig == nil then SpearheadConfig.CapConfig = {} end + if type(SpearheadConfig.CapConfig.enabled) ~= "boolean" then + SpearheadConfig.CapConfig.enabled = true + end + local enabled = SpearheadConfig.CapConfig.enabled if enabled == nil then enabled = true end self._isEnabled = enabled diff --git a/src/classes/persistence/Persistence.lua b/src/classes/persistence/Persistence.lua index 2684f90..eea895c 100644 --- a/src/classes/persistence/Persistence.lua +++ b/src/classes/persistence/Persistence.lua @@ -183,7 +183,9 @@ do local fileName = "Spearhead_Persistence.0.spearhead" if SpearheadConfig and SpearheadConfig.Persistence then if SpearheadConfig.Persistence.fileName then - + if type(SpearheadConfig.Persistence.fileName) ~= "string" then + SpearheadConfig.Persistence.fileName = "Spearhead_Persistence.0.spearhead" + end local userFileName = SpearheadConfig.Persistence.fileName local split = Util.split_string(userFileName, ".") @@ -201,7 +203,10 @@ do fileName = table.concat(split, ".") end - if SpearheadConfig.Persistence.directory ~= nil then + if SpearheadConfig.Persistence.directory then + if type(SpearheadConfig.Persistence.directory) ~= "string" then + SpearheadConfig.Persistence.directory = lfs.writedir() .. "\\Data" + end dir = SpearheadConfig.Persistence.directory end end