Module:Ru Paul's Drag Race tables

From blackwiki
Revision as of 00:16, 11 July 2020 by blackwiki>Wugapodes (contestant parsing)
Jump to navigation Jump to search

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