Skip to content

Commit c2a63ae

Browse files
committed
update for readability
1 parent b50f0bd commit c2a63ae

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

scm.lua

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,20 @@ function scm:refreshRepoScripts ()
179179
request.close()
180180

181181
local responseTable = textutils.unserializeJSON(response)
182+
183+
local programSuffix = self.config["programSuffix"]
184+
local librarySuffix = self.config["librarySuffix"]
185+
182186
for i = 1, #responseTable, 1 do
183-
if string.sub(responseTable[i]["name"], -string.len(self.config["programSuffix"])) == self.config["programSuffix"] then
184-
programs[string.sub(responseTable[i]["name"], 0, string.len(responseTable[i]["name"])-string.len(self.config["programSuffix"]))] = {}
185-
elseif string.sub(responseTable[i]["name"], -string.len(self.config["librarySuffix"])) == self.config["librarySuffix"] then
186-
libraries[string.sub(responseTable[i]["name"], 0, string.len(responseTable[i]["name"])-string.len(self.config["librarySuffix"]))] = {}
187+
local scriptName = responseTable[i]["name"]
188+
if string.sub(scriptName, -string.len(programSuffix)) == programSuffix then
189+
programs[
190+
string.sub(scriptName, 0, string.len(scriptName)-string.len(programSuffix))
191+
] = {}
192+
elseif string.sub(scriptName, -string.len(librarySuffix)) == librarySuffix then
193+
libraries[
194+
string.sub(scriptName, 0, string.len(scriptName)-string.len(librarySuffix))
195+
] = {}
187196
end
188197
end
189198
scm:log("Done")

0 commit comments

Comments
 (0)