RuneScape Wiki
Advertisement

Documentation for this module may be created at Module:ExchangeLite/doc

--[=[
{{Helper module|name=ExchangeLite
|fname1=load(frame)
|ftype1=table of form {args={'item', 'dataType'} }
|fuse1=Lightweight version of [[Module:Exchange]].

Returns the data type requested for the specified item. Any of the fields of an exchange page can be used (see [[Exchange:Fire rune]])
|fname2=price(item)
|ftype2=string
|fuse2=Takes an item name; returns the Grand Exchange price
}}
--]=]
-- <nowiki>
--
-- 
---- Lightweight version of Module:Exchange

local p = {}
local pageTemplate = {'Module:Exchange/', true}
local mw = mw

local function loadData(item)
    pageTemplate[2] = item
    local page = table.concat(pageTemplate)
    return mw.loadData(page)
end

-- usage:
-- local exg = require('Module:ExchangeLite')
-- local price = exg.load({args={'Divine charge', 'price' }})
function p.load(frame)
    local args = frame.args
    return loadData(args[1])[args[2]]
end

function p.price(item)
	return loadData(item).price
end

return p
Advertisement