Module:ClassInfo

local p = {} local data = mw.loadData('Module:ClassInfo/data')

function p.getId(name) for i, tc in ipairs(data) do		if tc.name == name then return tc.id		end for i1, tc1 in ipairs(tc['childs']) do			if tc1.name == name then if #tc1.id>0 then return tc1.id				else if #tc.id>0 then return tc.id					end end end end end return '' end

function p.getName(id) for i, tid in ipairs(data) do		if tid.id == id then return tid.name end for i1, tc1 in ipairs(tc['childs']) do			if tc1.id == id then if #tc1.name>0 then return tc1.name else if #tid.name>0 then return tid.name end end end end end return '' end

return p