Module:Difficulty level

local p = {} 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 function p.getLevel( frame ) local a = frame:getParent.args return _getLevel( a[1], a[2] ) or a.default or 'Undetermined: start a discussion relating to difficulty in the comments section below!' end return p