Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- rec.lua
- local id, message, lock, name, mode
- local info, num, val
- while true do
- id, message = rednet.receive()
- lock = message[4]
- name = message[2] .. ".lua"
- if lock == "greenblock" then
- mode = message[1]
- if (mode == "read") then
- if fs.exists("Accounts/" .. name) then
- info = fs.open("Accounts/" .. name, "r")
- num = info.readLine()
- rednet.send(id, num)
- info.close()
- elseif fs.exists("Accounts/" .. name) == false then
- info = fs.open("Accounts/" .. name, "w")
- info.writeLine("0.00")
- rednet.send(id, "0.00")
- info.close()
- end
- elseif mode == "write" then
- val = message[3]
- info = fs.open("Accounts/" .. name, "w")
- info.writeLine(val)
- info.close()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement