Module:Exchange

-- -- -- Implements --

local p = {}

-- -- Simple mw.loadData wrapper used to access data located on module subpages -- local function load( item ) return mw.loadData( 'Module:Exchange/' .. item ) end

function p._icon( item ) return 'icon' end

function p._diff( item ) return 'diff' end

function p._table( item ) return 'table' end

function p._data( item ) return 'data' end

-- -- For accessing data through #invoke -- function p.view( frame )

local fargs = frame.args local args = frame:getParent.args local view = fargs.View or fargs.view or pargs.View or pargs.view or 'price' local item = args[1]

view = mw.ustring.lower( view )

local ret_views = { price = true, limit = true, value = true }   local func_views = { icon = p._icon, diff = p._diff, table = p._table, data = p._data }

if ret_views[view] then return load( item )[view] end

if func_views[view] then return func_views[view]( item ) end

end

return p