Module:Data: Difference between revisions
Jump to navigation
Jump to search
imported>Jackmcbarn (create helper module to get values from a data module) |
imported>Jackmcbarn (redo how this works completely) |
||
Line 1: | Line 1: | ||
local | local mt = {} | ||
function | function mt.__index(t, k) | ||
return function(frame) | |||
local data = mw.loadData(k) | |||
for _,v in ipairs(frame.args) do | |||
data = data[v] | data = data[v] | ||
end | end | ||
return data | |||
end | end | ||
end | end | ||
return | return setmetatable({}, mt) |
Revision as of 02:56, 7 October 2014
Documentation for this module may be created at Module:Data/doc
local mt = {} function mt.__index(t, k) return function(frame) local data = mw.loadData(k) for _,v in ipairs(frame.args) do data = data[v] end return data end end return setmetatable({}, mt)