Module:Sandbox/User:Californ1a/PriceChecker: Difference between revisions

m
no edit summary
(Created page with "local p = {} -- Utility function to clean up number strings by removing commas local function cleanNumberString(value) if type(value) == "string" then return value:gsub(",", "") end return value end -- Non-dynamic module, no inputs function p.main() -- Returns only directly needed parameters for the row, -- other parameters are determined by subqueries of chained pages local query = { '-Sold item::~*', '?=Name',...")
 
mNo edit summary
 
Line 3:
-- Utility function to clean up number strings by removing commas
local function cleanNumberString(value)
if type(value) == "'string"' then
if value == 'N/A' then
return value:gsub(",", "")
return -1
end
return value:gsub("',"', ""'')
end
return value
Line 33 ⟶ 36:
local infoboxValue = item.InfoboxValue
if string.find(infoboxValue ==or nil'', '%S') then
infoboxValue = 0tonumber(cleanNumberString(infoboxValue))
else
elseif type(infoboxValue)=='string' then
infoboxValue = tonumber(cleanNumberString(item.InfoboxValue))-2
end
local hasMismatchhasMatch = false
for _, shopValue in ipairs(shopValues) do
if shopValue ~= "N/A" then-- Compare numeric values
--local ComparecleanShopValue numeric= valuescleanNumberString(shopValue)
local cleanShopValuenumericShopValue = cleanNumberStringtonumber(shopValuecleanShopValue)
localif numericShopValue == infoboxValue tonumber(cleanShopValue)then
if hasMatch numericShopValue and numericShopValue ~= infoboxValue thentrue
hasMismatch = trueend
break
end
end
end
-- Add the item to the output if any shopValue mismatched InfoboxValue
if hasMismatchnot hasMatch then
table.insert(out, item)
end
6,562

edits