Advertisement
Ceziy

ATMApi.lua

Nov 27th, 2023 (edited)
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.60 KB | None | 0 0
  1. function cardIn()
  2.     card = io.open("disk/id.txt")
  3.     if card == nil then return false
  4.     else return true
  5.     end
  6.     card.close()
  7. end
  8.  
  9. function getCardId()
  10.     card = io.open("disk/id.txt")
  11.     for line in card:lines() do
  12.         if cardIn() ~= false then return line end
  13.     end
  14. end
  15.  
  16. function printCent(y, s)
  17.     w,h = term.getSize()
  18.     x = math.floor((w - string.len(s)) / 2)
  19.     term.setCursorPos(x, y)
  20.     term.clearLine()
  21.     term.write(s)
  22.  end
  23.  
  24.  function getCardData()
  25.     rednet.send(0, "client " .. getCardId())
  26.     id, message = rednet.receive()
  27.     return message
  28.  end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement