Difference between revisions of "Module:Ru Paul's Drag Race tables"
Jump to navigation
Jump to search
blackwiki>Wugapodes (for loop skeleton to check order of args) |
blackwiki>Wugapodes (contestant parsing) |
||
| Line 3: | Line 3: | ||
function p.main( frame ) | function p.main( frame ) | ||
templateFrame = frame:getParent() | templateFrame = frame:getParent() | ||
| + | contestantData = {} | ||
ret = '' | ret = '' | ||
for k, v in pairs( templateFrame.args ) do | for k, v in pairs( templateFrame.args ) do | ||
| − | ret = ret .. k .. ' = ' .. v .. "\n" | + | ret = ret .. _getContestant(k) .. _getField(k) .. ' = ' .. v .. "\n" |
end | end | ||
return ret | return ret | ||
| + | end | ||
| + | |||
| + | local function _getContestant( k ) | ||
| + | return string.gmatch( k, "contestant\s(\d+)" ) | ||
| + | end | ||
| + | |||
| + | local function _getField( k ) | ||
| + | return string.gmatch( k, "contestant\s\d+-(.*)") | ||
end | end | ||
return p | return p | ||
Revision as of 00:16, 11 July 2020
| This module is rated as alpha. It is ready for third-party input, and may be used on a few pages to see if problems arise, but should be watched. Suggestions for new features or changes in their input and output mechanisms are welcome. |
This module implements {{Drag Race contestant table}} and {{Drag Race progress table}}. See the code for more details.
local p = {} --p stands for package
function p.main( frame )
templateFrame = frame:getParent()
contestantData = {}
ret = ''
for k, v in pairs( templateFrame.args ) do
ret = ret .. _getContestant(k) .. _getField(k) .. ' = ' .. v .. "\n"
end
return ret
end
local function _getContestant( k )
return string.gmatch( k, "contestant\s(\d+)" )
end
local function _getField( k )
return string.gmatch( k, "contestant\s\d+-(.*)")
end
return p