Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --local term = require("term")
- --local event = require("event")
- local slovo
- local ler
- local s
- local ss
- local sl
- local buf
- local g
- local slovofinal
- local name
- function savebuf()
- file = io.open("buf.txt", "w+")
- file:close()
- file = io.open("buf.txt", "a")
- file:write(buf)
- file:close()
- end
- function saveascii()
- file = io.open("ascii.txt", "a")
- file:write(g)
- file:close()
- end
- function openascii()
- file = io.open("ascii.txt", "r")
- buf = file:read()
- file:close()
- end
- function clearascii()
- file = io.open("ascii.txt", "w+")
- file:close()
- end
- while true do
- io.write(">")
- slovo = io.read()
- if slovo == "code" then
- io.write("code>")
- slovo = io.read()
- io.write("code=")
- clearascii()
- for i = 1,string.len(slovo) do
- g = string.byte(slovo,i).. "/"
- io.write(g)
- saveascii()
- end
- print()
- elseif slovo == "decode" then
- io.write("decode>")
- slovo = io.read()
- if slovo == "-bufer" then
- slovo = buf
- end
- s = 1
- io.write("decode=")
- while true do
- if (s + 1) > string.len(slovo) then break end
- ss = string.find(slovo,"/",s)
- sl = string.sub(slovo,s,ss-1)
- io.write(string.char(sl))
- -- print(sl)
- s = ss + 1
- end
- print()
- elseif slovo == "bufer" then
- openascii()
- print("bufer>".. buf)
- elseif slovo == "end" then
- break
- else print(" error")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment