Module:Sunken Treasure/Loot Rates/Sand: Difference between revisions

From Official Gamemode 4 Wiki
Jump to navigation Jump to search
m (Json file not web page)
m (I don't know how to Scribunto)
Line 1: Line 1:
mw.ext.externaldata.getWebData {
-- modified from https://strategywiki.org/wiki/Module:WikiList
url = "https://raw.githubusercontent.com/Gamemode4Dev/GM4_Datapacks/refs/heads/master/gm4_sunken_treasure/data/gm4_sunken_treasure/loot_table/chests/treasure_chest.json"
 
  , data = "type=Type,pool=Pool"
local p = {}
  , format = "JSON with JSONpath"
 
}
function p._format ( refList )
return refList
end
 
function p.wikiTable( frame )
local data = mw.ext.externaldata.getWebData {
url = "https://raw.githubusercontent.com/Gamemode4Dev/GM4_Datapacks/refs/heads/master/gm4_sunken_treasure/data/gm4_sunken_treasure/loot_table/chests/treasure_chest.json"
  , data = "json=_json"
}
local reflist = {}
for _, wikiData in pairs(data["json"]) do
mw.logObject(wikiData[type])
table.insert(refList, { type = wikiData["type"], pool = wikiData["pool"]})
end
return p._format( refList )
end
 
return p

Revision as of 05:22, 30 March 2025

Documentation for this module may be created at Module:Sunken Treasure/Loot Rates/Sand/doc

-- modified from https://strategywiki.org/wiki/Module:WikiList

local p = {}

function p._format ( refList )
	return refList
end

function p.wikiTable( frame )
	local data = mw.ext.externaldata.getWebData {
		url = "https://raw.githubusercontent.com/Gamemode4Dev/GM4_Datapacks/refs/heads/master/gm4_sunken_treasure/data/gm4_sunken_treasure/loot_table/chests/treasure_chest.json"
	  , data = "json=_json"
	}
	
	local reflist = {}
	for _, wikiData in pairs(data["json"]) do
		mw.logObject(wikiData[type])
		table.insert(refList, { type = wikiData["type"], pool = wikiData["pool"]})
	end
	
	return p._format( refList )
end

return p