LDDestroier

bank.lua

May 17th, 2021
823
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- bank.lua
  2. local tArgs = {...}
  3.  
  4. if #tArgs > 0 then
  5.     if tArgs[1] == "help" then
  6.         print("Usages:")
  7.         print("requestStatement(key, name, id)")
  8.         print("sendTransaction(key, name, sum, id)")
  9.  
  10.     else
  11.         local new = fs.open(tArgs[1] .. ".lua", "w")
  12.         new.writeLine("local id = --UserInput--")
  13.         new.close()
  14.     end
  15. end
  16.  
  17. function requestStatement(lock, name, pc)
  18.     rednet.send(pc, {"read", name, "placeholder", lock})
  19.     local id, message = rednet.receive()
  20.     if id == pc then
  21.         return message
  22.     end
  23. end
  24.  
  25. function sendTransaction(lock, name, sum, pc)
  26.     rednet.send(pc, {"write", name, sum, lock})
  27. end
RAW Paste Data