meuced

Fs API

Jun 5th, 2013
394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.73 KB | None | 0 0
  1. term.clear()
  2. if fs.exists("prenom") then
  3.     h = fs.open("prenom", "r")
  4.     prenom = h.readAll()
  5.     --prenom = h.readLine()
  6.     h.close()
  7.     term.setTextColor(colors.yellow)
  8.     print("Bonjour "..prenom.." !")
  9.     term.setTextColor(colors.red)
  10.     print("Mais peut-etre veux-tu changer de prenom ?")
  11.     term.setTextColor(colors.blue)
  12.     print("Si oui, indique ton nouveau prenom ci-dessous, sinon frappe simplement la touche ENTREE de ton clavier.")
  13.     new = read()
  14.     if new ~= "" then
  15.         h = fs.open("prenom", "w")
  16.         h.write(new)
  17.         h.close()
  18.         term.setTextColor(colors.yellow)
  19.         print("A bientot "..new.." !")
  20.     end
  21. else
  22.     h = fs.open("prenom", "w")
  23.     term.setTextColor(colors.yellow)
  24.     print("Quel est ton prenom : ")
  25.     h.write(read())
  26.     h.close()
  27. end
Advertisement
Add Comment
Please, Sign In to add comment