From 4839e6033d45c22473bfc969bd2bbdf9cbddd3f1 Mon Sep 17 00:00:00 2001 From: Josh Date: Thu, 20 Apr 2023 00:24:18 +0200 Subject: [PATCH 1/2] improve for loop --- scm.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/scm.lua b/scm.lua index 453a885..4c0f66b 100644 --- a/scm.lua +++ b/scm.lua @@ -662,6 +662,7 @@ function scm:updateScript (name, sourceName) if self.scripts[i].name == name then updateObj.source[sourceName] = self.scripts[i].source[sourceName] updateObj.type = self.scripts[i].type + break end end From ffc5ef1b04becd583c6d2df27a07ba5d817b1d28 Mon Sep 17 00:00:00 2001 From: Josh Date: Thu, 20 Apr 2023 00:49:33 +0200 Subject: [PATCH 2/2] remove file extension from pastebin download fix removeScript --- scm.lua | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scm.lua b/scm.lua index 4c0f66b..e1dc227 100644 --- a/scm.lua +++ b/scm.lua @@ -477,9 +477,9 @@ function scm:downloadPastebin (sourceObject, code, targetDirectory, updateObj) end if sourceObject.type == "program" then - shell.run("pastebin", "get", code, sourceObject.name .. ".lua") + shell.run("pastebin", "get", code, sourceObject.name) else - shell.run("pastebin", "get", code, targetDirectory .. sourceObject.name .. ".lua") + shell.run("pastebin", "get", code, targetDirectory .. sourceObject.name) end return sourceObject, true @@ -604,15 +604,15 @@ function scm:removeScript (name, keepScriptConfig) local o = {} local scriptType = nil - if keepScriptConfig ~= true then - for i = 1, #self.scripts, 1 do - if self.scripts[i].name ~= name then - table.insert(o, self.scripts[i]) - else - scriptType = self.scripts[i].type - end + for i = 1, #self.scripts, 1 do + if self.scripts[i].name ~= name then + table.insert(o, self.scripts[i]) + else + scriptType = self.scripts[i].type end - + end + + if keepScriptConfig ~= true then self.scripts = o self:saveScripts() end