Module:Achievement

local p = {} function p.data( f ) local args = f:getParent.args if args[1] == nil then return 'not enough parameters' end

local path = args[1]

-- for backwards compatibility if args[2] ~= nil then path = path .. '/' .. args[2] end

path = path:gsub('[^%w/]', ''):lower

local folders = {} for part in string.gmatch(path..'/', "([^/]*)/") do   table.insert(folders, part) end

local data = mw.loadData('Module:Achievement/list')

local node = data

for _,f in ipairs(folders) do   if node[f] ~= nil then node = node[f] else return '' -- no data available for given path end end

if type(node) == 'table' then return 'parameter not specific enough' -- given path leads to a folder instead of a value else return node end end return p