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

--[[ This module contains common objects that could be used by many other modules
     Therefore it cannot be invoked by templates ]]
-------------------------------------------------------------------------------
--[[
Functions:
+ setDefault(argument, value): Set default 'value' to argument, if 'value' is not defined, argument will be default to empty string.

+ colorLinks(argument):  fix link and font color for games that have light BG.

+ isnotNil(argument): return true if not nil, else false

+ capitalize(argument): capitalize string
]]
-------------------------------------------------------------------------------
local common = {}

function common.setDefault(arg, val)
    if(arg == nil) then
        if(val == nil) then arg = ''
        else arg = val end
    end
    return arg
end

function common.colorLinks(arg)
    local class
    local games = {
        'fe2', 'fe6', 'fe8', 'fe12', 'fe13', 'fe14',
        'fe15', 'feh', 'ts2', 'tms', 'smt'
    }
    
    for i = 0, #games do
        if(arg == games[i]) then
            class = 'light'
            break
        else class = 'dark'
        end
    end
    return class
end

function common.isnotNil(arg)
    if(arg ~= nil) then return true
    else return false end
end

function common.capitalize(arg)
    -- in progress
end

return common
--[[Category:Modules]]
Community content is available under CC-BY-SA unless otherwise noted.