본문으로 이동

모듈:Maintenance data

겜스 위키 (구 게임세상)

이 모듈에 대한 설명문서는 모듈:Maintenance data/설명문서에서 만들 수 있습니다

-- <pre>
--- Returns the static maintenance data.
--- Used by [[Template:Current maintenance data]]
--- Syntax: {{cmd|<keyword>}} or {{current maintenance data|<keyword>}}

local p         = {}
local lib       = require('Module:Feature')
local userError = require('Module:Dev:User error')
local keyword   = mw.loadData('Module:Maintenance data/data')

--% Entry point to use module
--@ frame (table) A scribunto frame
--: (string) The return content of the keyword or "N/A"
function p.main(frame)
    local args = lib.frameArguments(frame)
    
    local s = keyword[args[1]]
    if s == nil then
        return userError("Unrecognized parameter: ''" .. args[1] .. "''", "LuaError")
    end
    
    if type(s) == "table" then
        return s[tonumber(args[2])]
    else
        return s
    end
end

return p
-- </pre>
-- [[Category:Lua]]