Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function initializeApplication()
- local path = system.pathForFile("res/init/navigation_map.xml")
- if path then
- local appMap = parseXml("res/init/navigation_map.xml")
- local contents = appMap.children[1].children
- local subTrees = {}
- local entry
- local function levelParser(level)
- if level and level ~= {} then
- local tbl = {}
- for i = 1, #level do
- local str = level[i].attrs.name
- local name
- if not tostring(str):find("@") then
- name = "src." .. tostring(str)
- else
- if tostring(str)== "@exit" then
- name = "exit"
- elseif tostring(str):find("@url") then
- name = "url here lol"
- elseif tostring(str):match("@%w") then
- val = tostring(str):gsub("@", "")
- level[i].children = subTrees[val]
- name = subTrees[val].name
- end
- end
- tbl[i] = {}
- tbl[i][level[i].tag] = {
- name = name,
- levelParser(level[i].children)
- }
- end
- return tbl
- end
- end
- for i = 1, #contents do
- if contents[i].tag == "define" then
- subTrees[contents[i].attrs.shortName] = {
- name = contents[i].attrs.name,
- children = contents[i].children
- }
- elseif contents[i].tag == "entry" then
- local name = "src." .. tostring(contents[i].attrs.name)
- entry = {
- name = name,
- children = contents[i].children
- }
- end
- end
- if entry then
- APPLICATION_MAP = levelParser(entry.children)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement