Editing Module:ChefList
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 24: | Line 24: | ||
} |
} |
||
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 48: | Line 46: | ||
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 = 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 |
||