Module:Uses skill list: Difference between revisions
Content deleted Content added
Created page with "local p = {} local geprice = require('Module:Exchange')._price local commas = require('Module:Addcommas') local skillpic = require('Module:SCP')._main local yesno = require('Module:Yesno') local lang = mw.getContentLanguage() local trim = mw.text.trim -- Sorting function for two item objects, first by name, then by sub-text function sortItemsByNameSubtext(item1, item2) if (item1.output.name < item2.output.name) then return true elseif (item1.output.name > item2.out..." |
No edit summary |
||
| (10 intermediate revisions by the same user not shown) | |||
Line 24:
function p._main(args)
local
local
local category = args.category and trim(args.category) or nil
-- Process skill arguments
table.insert(
else
local i = 1
Line 35 ⟶ 37:
local arg = trim(args[i])
table.insert(
i = i + 1
Line 42 ⟶ 44:
end
--
local query = {
'[[Uses skill::' .. table.concat(
'[[Production JSON::+]]',
'?=#-',
Line 51 ⟶ 53:
}
-- Add category filter if provided
if category then
table.insert(query, '[[RecipeCategory::' .. category .. ']]')
-- Fetch data
local t1 = os.clock()
local smw_data = mw.smw.ask(query)
Line 84 ⟶ 92:
-- Render page
local t = mw.html.create('table')
t:addClass('wikitable sortable products-list align-center-1 align-right-3 align-right-4 autosort=3,a')
local ttlrow = t:tag('tr')
Line 110 ⟶ 118:
-- Render rows
for _, item in ipairs(data) do
local
▲ _found = true
break
end
end
if
local name_str
Line 184 ⟶ 191:
local qty = mat_info.quantity:gsub('%-', '–')
local mat_name = mat_info.name
▲ for _, mat in ipairs(materials_lowered) do
▲ end
if mat_sort_val == nil then
Line 223 ⟶ 220:
if rows == 0 then
return 'Failed to find products with those
end
| |||