Advertisement
Ceziy

card_info.lua

Nov 28th, 2023
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.76 KB | None | 0 0
  1. os.loadAPI("ATMApi.lua")
  2.  
  3. os.pullEvent = os.pullEventRaw
  4.  
  5. message = ATMApi.getCardData()
  6.  
  7. local w,h = term.getSize()
  8.  
  9. local t_name = "Name: "
  10. local t_bal = "Balance: "
  11. local t_num = "Number: "
  12.  
  13. local back_button = "[ Back ]"
  14.  
  15. function update()
  16.     term.clear()
  17.  
  18.     ATMApi.printCent(math.floor(h/2) - 2, t_name .. message.name)
  19.     ATMApi.printCent(math.floor(h/2) - 1, t_num .. message.num)
  20.     ATMApi.printCent(math.floor(h/2) - 0, t_bal .. message.bal)
  21.     ATMApi.printCent(math.floor(h/2) + 2, back_button)
  22. end
  23.  
  24. update()
  25.  
  26. while true do
  27.     local event, key = os.pullEvent("key")
  28.    
  29.     if key == keys.enter then
  30.         if ATMApi.cardIn() == true then shell.run("main_menu")
  31.         else shell.run("main")
  32.         end
  33.     end
  34.     update()
  35. end
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement