Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ Explorateur Lua v1.1
- Module à destination de personnes sachant coder, ce module vous permet d'observer la mémoire utilisée par vos modules pendant qu'ils sont actifs.
- Variables globales utilisées par le module :
- exploLua
- table.copy
- Fonctions de l'api utilisées :
- eventTextAreaCallback
- Ids de textArea utilisés :
- 2112 / 2113 / 2114 / 2115 / 2116 / 2117 / 2118
- ]]--
- --[[ Module exploLua (début)
- Merci de ne rien modifier
- ]]
- local exploLua = {}
- function exploLua.init()
- exploLua.info = {}
- for name in pairs(tfm.get.room.playerList) do exploLua.newP(name) end
- end
- function exploLua.newP(name)
- exploLua.info[name] = {}
- exploLua.info[name].path = {"_G"}
- ui.addTextArea(2112, "<a href='event:open'>open</a>", name, 5, 377, 50, 18, 0x27373f, 0x27373f, 1, true)
- end
- function exploLua.openWind(name)
- ui.addTextArea(2113, "<b><p align='right'><a href='event:'>X</a></p></b>", name, 150, 50, 500, 300, 0x27373f, 0x27373f, 1, true) -- fond1
- ui.addTextArea(2114, "", name, 150, 75, 500, 275, 0x324650, 0x27373f, 1, true) -- fond2
- ui.addTextArea(2115, "", name, 175, 85, 450, 20, 0x27373f, 0x27373f, 1, true) -- chemin
- ui.addTextArea(2116, "", name, 175, 120, 140, 200, 0x27373f, 0x27373f, 1, true) -- liste noms
- ui.addTextArea(2117, "", name, 330, 120, 140, 200, 0x27373f, 0x27373f, 1, true) -- liste types
- ui.addTextArea(2118, "", name, 485, 120, 140, 200, 0x27373f, 0x27373f, 1, true) -- liste valeurs
- eventTextAreaCallback(2115, name, #exploLua.info[name].path)
- end
- function exploLua.closeWind(name)
- ui.removeTextArea(2113, name); ui.removeTextArea(2114, name); ui.removeTextArea(2115, name); ui.removeTextArea(2116, name); ui.removeTextArea(2117, name); ui.removeTextArea(2118, name)
- ui.addTextArea(2112, "<a href='event:open'>open</a>", name, 5, 377, 50, 20, 0x27373f, 0x27373f, 1, true)
- end
- function exploLua.open(name)
- local path = exploLua.info[name].path
- local tab, path = exploLua.folder(table.copy(exploLua.info[name].path))
- exploLua.info[name].path = path
- local files = ""
- local typ = ""
- local values = ""
- local way = ""
- for key, val in pairs(tab) do
- files = files.."<a href='event:"..tostring(key).."'>"..tostring(key).."</a>\n"
- values = values..tostring(val)..'\n'
- typ = typ..type(val)..'\n'
- end
- for key, val in ipairs(path) do
- way = way.."<a href='event:"..tostring(key).."'>"..val..".</a>"
- end
- ui.updateTextArea(2115, way, name)
- ui.updateTextArea(2116, files, name)
- ui.updateTextArea(2117, typ, name)
- ui.updateTextArea(2118, values, name)
- end
- function exploLua.folder(path, tab, way)
- tab = tab or _G
- way = way or {"_G"}
- if path[2] then
- if type(tab[path[2]]) == "table" then
- tab = tab[path[2]]
- table.insert(way, path[2])
- table.remove(path, 2)
- return exploLua.folder(path, tab, way)
- else
- local code = string.gsub (string.gsub (tostring(tab[path[2]]), '<', '<'), '>', '>')
- local comp = 0
- while comp < #code do
- print(code:sub(comp, comp+4500))
- comp = comp+4501
- end
- end
- end
- return tab, way
- end
- function table.copy(tab)
- local res = {}
- for key, val in pairs(tab) do res[key] = val end
- return res
- end
- --[[Module exploLua (fin)
- Vous pouvez modifier les fonctions qui suivent
- (attention à ne pas empècher les tests de la fonction eventTextAreaCallback)
- ]]
- function eventTextAreaCallback(id, name, call)
- --
- -- Module exploLua (début)
- if id==2115 then
- local i = #exploLua.info[name].path - tonumber(call)
- for k=1,i do table.remove(exploLua.info[name].path) end
- exploLua.open(name)
- elseif id == 2116 then
- table.insert(exploLua.info[name].path, tonumber(call) or call)
- exploLua.open(name)
- elseif id == 2112 then
- ui.removeTextArea(2112, name)
- exploLua.openWind(name)
- elseif id == 2113 then exploLua.closeWind(name)
- end
- -- Moduel exploLua (fin)
- end
- -- Ligne d'initialisation du module exploLua
- exploLua.init()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement