Module:Definitions: Difference between revisions
From SpiritVale Wiki
More actions
No edit summary Tags: Reverted Mobile edit Mobile web edit |
No edit summary Tags: Reverted Mobile edit Mobile web edit |
||
| Line 201: | Line 201: | ||
-- ============================================================================= | -- ============================================================================= | ||
local function | local function _render(domain, key) | ||
local db = load_db() | local db = load_db() | ||
domain = norm_domain(db, domain) | domain = norm_domain(db, domain) | ||
| Line 267: | Line 267: | ||
function p.def(frame) | function p.def(frame) | ||
local a = frame.args or {} | local a = frame.args or {} | ||
return | return _render(a[1] or a.Domain or a.domain, a[2] or a.Key or a.key) | ||
end | end | ||
function p.render( | -- Supports BOTH: | ||
return | -- 1) Wikitext: {{#invoke:Definitions|render|Stat|Vit}} | ||
-- 2) Lua: p.render("Stat","Vit") | |||
function p.render(a, b) | |||
if type(a) == "table" then | |||
local args = a.args or {} | |||
return _render(args[1], args[2]) | |||
end | |||
return _render(a, b) | |||
end | end | ||
return p | return p | ||