Module:ChefPassiveList: Difference between revisions

simplify code: doesnt need to screen all chef recipes for which are passive, just specify a list of variants instead
m (display IMG ERR for missing image, but its the ~same size as an image)
(simplify code: doesnt need to screen all chef recipes for which are passive, just specify a list of variants instead)
Line 12:
-- other parameters are determined by subqueries of chained pages
local query = {
'[[Variant of::Roasted Sturlet||Dab Stew||Mackibut on Toast||Baked Bream||Garlic Herring]]',
'[[-Sold item.Sold by::Head Chef (shop)]]',
'?Profession Level A = lvl',
'? #- = name',
Line 23:
}
local results = mw.smw.ask(query)
 
results = p.screenResults(results,true)
 
results = p.formatResults(results)
Line 47 ⟶ 45:
end
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
 
21,691

edits