Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- declare('rmlpairs', {})
- local context
- local docs
- local options
- function rmlpairs.init()
- context = rmlui.contexts[1]
- docs = rmlui.contexts[1].documents
- options = nil
- for i = 1, 10 do
- if (docs[i].title == "Options") then
- options = docs[i]
- break
- end
- end
- if (options == nil) then
- options = {"Options Document not found"}
- end
- end
- local function proxyipairs(thing)
- console_print("ipairs()\n"..string.rep("-", 50))
- for i, v in ipairs(thing) do
- console_print(" ["..i.."] = "..tostring(v))
- end
- end
- local function proxypairs(thing)
- console_print("pairs()\n"..string.rep("-", 50))
- for k, v in pairs(thing) do
- console_print(" ["..k.."] = "..tostring(v))
- end
- end
- local function pcallwrapper(func, ...)
- local retval, err = pcall(func, ...)
- if (not retval) then
- console_print(err)
- end
- end
- function rmlpairs.print(thing)
- if (not thing) then return end
- local thing_name = tostring(thing):match("^%S+")
- if (thing_name:match("Proxy")) then
- console_print("\n"..thing_name)
- pcallwrapper(proxyipairs, thing)
- console_print("\n")
- pcallwrapper(proxypairs, thing)
- end
- end
- function rmlpairs.printall()
- rmlpairs.print(rmlui.contexts)
- rmlpairs.print(docs)
- rmlpairs.print(options.attributes)
- rmlpairs.print(options.child_nodes)
- end
Advertisement
Add Comment
Please, Sign In to add comment