From e2a9b8046d93daeefdb05af2eda37f6b2b33a6d2 Mon Sep 17 00:00:00 2001 From: Shy Date: Thu, 29 Aug 2024 17:47:28 +0200 Subject: [PATCH] Renamed some variables --- c4mate | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/c4mate b/c4mate index c9f86dc..d9baa0f 100755 --- a/c4mate +++ b/c4mate @@ -220,9 +220,9 @@ function MatePad:print_log(log) end -- Get available items. -function MatePad:get_roster() +function MatePad:get_offerings() local pipe, ok, exit, signal - local roster = {} + local offerings = {} -- sed #1: Extract items section and insert newlines between entries. -- sed #2: Extract and print id, name and price. If any extraction fails we -- fail with exit code 1. @@ -253,7 +253,7 @@ sed -n --sandbox ' if item.id == nil then break end item.name = utf8_decode(pipe:read()) item.price = tonumber(pipe:read()) - table.insert(roster, item) + table.insert(offerings, item) end ok, exit, signal = pipe:close() @@ -261,11 +261,11 @@ sed -n --sandbox ' io.stderr:write("Sorry, there was an error while parsing the API response.\n") -- Empty table will throw no exceptions. return {} - elseif roster == nil then -- curl error + elseif offerings == nil then -- curl error io.stderr:write("Sorry, there was an error while connecting the API.\n") return {} end - return roster + return offerings end -- Buy given item. @@ -419,13 +419,13 @@ elseif tonumber(arg[1]) ~= nil then else -- Find and buy item. - local roster, query, input, ok - roster = pad:get_roster() + local offerings, query, input, ok + offerings = pad:get_offerings() query = table.concat(arg, " "):lower() local menu = {} - for i = 1, #roster do - local item = roster[i] + for i = 1, #offerings do + local item = offerings[i] if item.name:lower():match(query) then table.insert(menu, item) end