Diamond Digger Saga Wiki
Advertisement
Diamond Digger Saga Wiki

Documentation for this module may be created at Module:Leveltype/doc

local p = {}
 
local _lookupTable = 'Module:Leveltype/List'
 
local score = 'score'
local firefly = 'firefly'
local toy = 'toy'
local totem = 'totem'
 
local function _lookupTypeStatus( levelName )
	if levelName and not (levelName == '') then
    	local level = levelName:match('^Level (%d+)')
    	if level then 
            local data = mw.loadData( _lookupTable )
            return data[tonumber(level)]
        end
    end
    return false
end
 
function p.type(frame)
	local leveltype = frame.args[1]
    local text = ''
        if _lookupTypeStatus(leveltype) == score then
        	text = "Score"
        elseif _lookupTypeStatus(leveltype) == firefly then
    	    text = "Firefly"
    	elseif _lookupTypeStatus(leveltype) == toy then
    	    text = "Toy"
    	elseif _lookupTypeStatus(leveltype) == totem then
    	    text = "Totem"
	    else
	        text = "''Unknown''"
        end
    return text
end
 
return p
Advertisement