Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local filesystem = require("filesystem")
- local component = require("component")
- local string = require("string")
- local gpu = component.gpu
- local resX = gpu.getResolution()
- local functions = 0
- local functionsFinded = {}
- local number = math.random(1, 10000000000)
- if not filesystem.exists("/functionsScanner/") then
- filesystem.makeDirectory("/functionsScanner/")
- else
- file = io.open("/functionsScanner/" .. number .. ".txt", "w")
- end
- io.write("Путь к библиотеке: ")
- local lib = io.read()
- if not filesystem.exists(lib) then
- io.stderr:write("Файла " .. lib .. " не существует!\n")
- return
- end
- print("Выполняется полное сканирование библиотеки...")
- for line in io.lines(lib) do
- if string.sub(line, 1, 8) == "function" then
- table.insert(functionsFinded, string.sub(line, 10, resX))
- functions = functions+1
- end
- end
- if functions < 1 then
- io.stderr:write("Ни одна функция не была найдена.")
- elseif functions > 0 then
- print("Сканирование завершено.")
- print("Сохранение...")
- file:write("Programist135 library functions scanner\n")
- file:write("--------------------------------------------\n")
- file:write("Найденные функции (" .. functions .. "): \n")
- for _, findedFunction in pairs(functionsFinded) do
- file:write(findedFunction .. "\n")
- end
- file:flush()
- file:close()
- print("Файл сохранен как /functionsScanner/" .. number .. ".txt")
- end
Advertisement
Add Comment
Please, Sign In to add comment