Module:Sandbox

local p = {} function p.getArgs( frame ) local a = frame.args return '_' .. a[1] .. '_ _' .. a[2] .. '_' end

function p.getParentArgs( frame ) local a = frame:getParent.args return '_' .. a[1] .. '_ _' .. a[2] .. '_' end

-- code ripped from Module:Difficulty level for testing

function p.getLevel( frame ) local a = frame:getParent.args return _getLevel( a[1] or mw.title.getCurrentTitle.text, a[2] ) or a.default or 'Undetermined: start a discussion relating to difficulty in the comments section below!' end local function _getLevel( pageName, version ) if not pageName or pageName == '' then return false end -- Setup local level = pageName:match('^Level (%d+)') if not level then return false end local isDreamworld = pageName:match('/Dreamworld') -- Get difficulty for the page local data = mw.loadData( 'Module:Difficulty level/' .. ( isDreamworld and 'Dreamworld' or 'Reality' ) ) local myDifficulty = data[tonumber(level)] if not myDifficulty then return false end -- Parse difficulty if type( myDifficulty ) == 'string' then return myDifficulty elseif version == 'Facebook' then return myDifficulty[1] elseif version == 'Mobile' then return myDifficulty[2] else return mw.getCurrentFrame:preprocess('\n\n') end end return p