Reinified

Untitled

May 13th, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. local function getMoney()
  2. local creditCard = fs.open("disk/creditCard", "r")
  3. local money = creditCard.readAll()
  4. creditCard.close()
  5. return money
  6. end
  7. local function addMoney(toAdd)
  8. local creditCard = fs.open("disk/creditCard", "w")
  9. local newMoney = getMoney() + toAdd
  10. if newMoney < 0 then
  11. creditCard.close()
  12. return false
  13. else
  14. creditCard.write(newMoney)
  15. creditCard.close()
  16. return true
  17. end
  18. end
Add Comment
Please, Sign In to add comment