Content added Content deleted
No edit summary |
No edit summary |
||
Line 10: | Line 10: | ||
return k.npc, v[1] |
return k.npc, v[1] |
||
else |
else |
||
return 'fail' |
|||
end |
end |
||
Revision as of 11:03, 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.npc, v[1]
else
return 'fail'
end
end
end
return p