Content added Content deleted
No edit summary |
No edit summary |
||
Line 10: | Line 10: | ||
return k, v |
return k, v |
||
else |
else |
||
return k |
|||
error('Incorrect NPC name') |
|||
end |
end |
||
end |
end |
Revision as of 11:44, 23 November 2021
This module retrieves data from the "Loot tables.json" template according to the {{PAGENAME}} (usually, an NPC name) provided as an argument value.
local json = require('Module:Json')
local lootTables = json.decode(mw.getCurrentFrame():expandTemplate{title='Template:Items.json'})
local p = {}
p.getLootTable = function(frame)
local npc = frame.args[1]
for k, v in pairs(lootTables) do
if k == npc then
return k, v
else
return k
end
end
end
return p