Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = {...}
- local h
- local file = tArgs[1]
- local data
- if fs.exists(shell.resolve(file)) then
- h = fs.open(file,'rb')
- else
- error()
- end
- local l = fs.open("tmp",'w')
- local str = ""
- while true do
- data = h.read()
- if data then
- if tArgs[2] == "c" or nil then
- data = data - 5
- elseif tArgs[2] == "p" then
- data = data + 5
- end
- str = str..string.char(data)
- else
- break
- end
- end
- l.write(str)
- l.close()
- function replace()
- h = fs.open(file,'w')
- l = fs.open("tmp",'rb')
- local str = ""
- while true do
- local dat = l.read()
- if dat then
- str = str..string.char(dat)
- else
- break
- end
- end
- l.close()
- h.write(str)
- h.close()
- end
- replace()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement