Module:Sandbox/User:Alsang/NodeDescriptionChecker: Difference between revisions

Jump to navigation Jump to search
Content added Content deleted
(working for stonemason, need to check all data)
(remove unused subroutine)
Line 28: Line 28:
}
}
local results = mw.smw.ask(query)
local results = mw.smw.ask(query)

results = p.screenResults(results,false)


results = p.formatResults(results)
results = p.formatResults(results)
Line 52: Line 50:
end
end
return currency._cell(amount, { html = 'yes' })
return currency._cell(amount, { html = 'yes' })
end

-- Need to split the table into two, lines with crates are passive and lines without are not
function p.screenResults(results,isPassive)
local resultsPassive = {}
local resultsNotPassive = {}
-- iterate through products
for _, item in ipairs(results) do
local hasCrate = item.recipeJSON and string.find(item.recipeJSON,'Crate')
if hasCrate then
table.insert(resultsPassive,item)
else
table.insert(resultsNotPassive,item)
end
end
if isPassive then
return resultsPassive
else
return resultsNotPassive
end
end
end