Path of Exile Wiki

Please consider helping keep the wiki up to date. Check the to-do list of updates needed for version 3.14.0.

Game data exports will becoming later as the technical changes in addition to regular changes take some more time.

READ MORE

Path of Exile Wiki
Advertisement
Module documentation[view] [edit] [history] [purge]

Implements {{error}}.

-------------------------------------------------------------------------------
-- 
--                               Module:Error
-- 
-- This module implements Template:Error
-------------------------------------------------------------------------------

local cfg = {}

cfg.i18n = {}

cfg.i18n.errors = {
    no_message = 'No message specified',
}

cfg.tag = 'strong'

-- ----------------------------------------------------------------------------
-- Main function
-- ----------------------------------------------------------------------------

local function _main(args)
    args.message = args.message or args[1]
    if not args.message or args.message == '' then
        error(cfg.i18n.errors.no_message, 2)
    end
    local html = mw.html.create(cfg.tag)
        :addClass('error')
        :wikitext(tostring(args.message))
    return tostring(html)
end

-- ----------------------------------------------------------------------------
-- Exported functions
-- ----------------------------------------------------------------------------

local p = {}

function p.main(frame)
    local args
    if type(frame.args) == 'table' then
        -- Called via #invoke, so use the args that were passed into the 
        -- template.
        args = frame.args
    else
        -- Called from another module or from the debug console, so assume args 
        -- are passed in directly.
        args = frame
    end
    return _main(args)
end

p.error = p.main

return p
Advertisement