Module:Sandbox/User:Alsang: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
No edit summary |
(Replaced content with "local p = {} function p.main() return end return p") Tag: Replaced |
||
(26 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
local p = {} |
local p = {} |
||
function p. |
function p.main() |
||
⚫ | |||
local query = { |
|||
'[[Variant of::Flint||Andesite||Granite||Basalt||Deathstone||Iron Ore||Cabranese Ore||Adathril Ore||Flantium Ore]]', |
|||
'? #- = name', |
|||
'?Profession Level A = level', |
|||
'?Variant of = variant', |
|||
'sort = Profession B,Variant of,Profession Level A', |
|||
'limit = 500' |
|||
} |
|||
local results = mw.smw.ask(query) |
|||
for _,page in ipairs(results) do |
|||
local result = mw.smw.ask('[['..page.name..' (skill node)]]|?Activity JSON = data') |
|||
page.JSON = (result and result[1] and result[1].data) or '' |
|||
if type(page.JSON)=='table' then |
|||
page.JSON = table.concat(page.JSON,'<br>') |
|||
end |
|||
end |
|||
local out = mw.html.create('table') |
|||
:addClass('wikitable sortable') |
|||
:tag('tr') |
|||
:tag('th') |
|||
:wikitext('Variant') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('Level') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('Page') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('Node') |
|||
:done() |
|||
:tag('th') |
|||
:wikitext('Node JSON') |
|||
:done() |
|||
:done() |
|||
for i, item in ipairs(results) do |
|||
local row = out:tag('tr') |
|||
--level |
|||
:tag('td') |
|||
:wikitext(item.variant) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.level) |
|||
:done() |
|||
:tag('td') |
|||
:wikitext('[['..item.name..']]') |
|||
:done() |
|||
:tag('td') |
|||
:wikitext('[['..item.name..' (skill node)]]') |
|||
:done() |
|||
:tag('td') |
|||
:wikitext(item.JSON) |
|||
:done() |
|||
end |
|||
⚫ | |||
end |
end |
||
Latest revision as of 12:51, 6 January 2025
Module documentation
This documentation is transcluded from Module:Sandbox/User:Alsang/doc. [edit] [history] [purge]
This module does not have any documentation. Please consider adding documentation at Module:Sandbox/User:Alsang/doc. [edit]
Module:Sandbox/User:Alsang's function main is invoked by Template:Sandbox/User:Alsang.