No edit summary |
No edit summary |
||
Line 5: | Line 5: | ||
json = firstToUpper(json) | json = firstToUpper(json) | ||
json = 'Module:Spell/Domain/' .. json .. '.json' | json = 'Module:Spell/Domain/' .. json .. '.json' | ||
local | local spells = mw.loadJsonData(json) | ||
local out = {} | local out = {} | ||
for | for i,v in pairs(spells) do | ||
table.insert(out, spells[v]) | |||
end | end | ||
Revision as of 14:05, 24 February 2023
Usage
{{#invoke:spell|list|domain=}}
{{#invoke:spell|list|category=}}
local p = {} function p.getDomainList(frame) local json = frame.args[1] json = firstToUpper(json) json = 'Module:Spell/Domain/' .. json .. '.json' local spells = mw.loadJsonData(json) local out = {} for i,v in pairs(spells) do table.insert(out, spells[v]) end return table.concat(out, "<br>") end function firstToUpper(str) return (str:gsub("^%l", string.upper)) end return p