Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --inistaller maked with tabler pastebin: MgqZYDtR
- lib = {'function write2file(path, array)', ' f = fs.open(path, "w")', ' for i = 1, #array do', ' f.writeLine(array[i]) ', ' end', ' f.close()', 'end', ' ', 'function readFromFile(path)', ' f = fs.open(path, "r")', ' local array = {}', ' local i = 1', ' local temp', ' while true do', ' temp = f.readLine()', ' if not temp then break end', ' array[i] = temp', ' i = i + 1', ' end', ' f.close()', ' return array', 'end', ' ', 'function array2String(array, d)', ' string = ""', ' for i = 1, #array do', ' string = string .. array[i] .. d', ' end', ' return string', 'end'}
- receive = {'os.loadAPI("lib")', 'rednet.open("top")', 'id, msg = rednet.receive()', 'print(msg)', 'array = {}', 'array[1] = msg', 'lib.write2file("test", array)'}
- send = {'local args = {...}', 'os.loadAPI("lib")', ' ', 'array = lib.readFromFile(args[1])', 'string = lib.array2String(array, "\n")', 'rednet.open("top")', 'rednet.send(tonumber(args[2]), string)'}
- v = "1.0.1"
- text = "Welcome to rednet files inistaller!"
- xScr, yScr = term.getSize()
- --
- function setup(file, name)
- local h = fs.open(name, "w")
- for i = 1, #file do
- h.writeLine(file[i])
- end
- h.close()
- end
- function aans()
- ans = read()
- return ans
- end
- --
- if #text > xScr - 5 then
- print("Welcome!")
- else print(text)
- end
- print("Do you really want ")
- print("to inistall rednet files?")
- print("y/n")
- aans()
- if ans == "y" then
- setup(lib, "lib")
- sleep(0.5)
- print("lib inistalled")
- setup(send, "send")
- sleep(0.5)
- print("send inistalled")
- setup(receive, "receive")
- sleep(0.5)
- print("receive inistalled")
- elseif ans == "n" then
- term.clear()
- term.setCursorPos(1, 1)
- else print("Unreadable input.")
- aans()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement