Happy Early Access Launch! Please bear with us: We're doing our best to get the site updated. If we currently don't have what you're looking for, try checking our sister site, beastieball.info.
If you're looking to contribute to the site, we're happy to have you! Check out Beastiepedia:To Do List to see what needs done.
Find us in the Wishes Unlimited Discord in the "Beastiepedia: The Beastieball Wiki" thread in the Forums!
Module:Learners: Difference between revisions
From Beastiepedia: The Beastieball Wiki
(Created page with "local p = {} local cargo = mw.ext.cargo local getArgs = require('Module:Arguments').getArgs function p.Main( frame ) local args = getArgs(frame) local play = args[1] or mw.title.getCurrentTitle().text local levels = args["level"] levels = levels and levels ~= "" local tables = (levels and "BeastieLearnset") or "BeastieLearnFriend" local fields = (levels and {"Beastie", "Plays"}) local where = tables .. ".Plays HOLDS LIKE '" .. ((levels a...") |
No edit summary |
||
Line 10: | Line 10: | ||
local tables = (levels and "BeastieLearnset") or "BeastieLearnFriend" | local tables = (levels and "BeastieLearnset") or "BeastieLearnFriend" | ||
local fields = (levels and | local fields = (levels and "Beastie,Plays") or "Beastie" | ||
local where = tables .. ".Plays HOLDS LIKE '" .. ((levels and play .. "%") or play) .. "'" | local where = tables .. ".Plays HOLDS LIKE '" .. ((levels and play .. "%") or play) .. "'" | ||
local results = cargo.query(tables, fields, {where=where}) | local results = cargo.query(tables, fields, {where=where}) |
Revision as of 15:55, 19 November 2024
Documentation for this module may be created at Module:Learners/doc
local p = {} local cargo = mw.ext.cargo local getArgs = require('Module:Arguments').getArgs function p.Main( frame ) local args = getArgs(frame) local play = args[1] or mw.title.getCurrentTitle().text local levels = args["level"] levels = levels and levels ~= "" local tables = (levels and "BeastieLearnset") or "BeastieLearnFriend" local fields = (levels and "Beastie,Plays") or "Beastie" local where = tables .. ".Plays HOLDS LIKE '" .. ((levels and play .. "%") or play) .. "'" local results = cargo.query(tables, fields, {where=where}) local tbl = mw.html.create('table'):addClass('wikitable') local header = tbl:tag("tr") :tag("th"):wikitext("Beastie"):done() if levels then header:tag("th"):wikitext("Levels") end for _, result in ipairs(results) do local tr = tbl:tag("tr") tr:tag("td"):wikitext(result.Beastie) if levels then tr:tag("td"):wikitext(result.Plays) end end return tbl end return p