Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local term = require("term")
- function display()
- local fichier = io.open("satids.txt", "r")
- if fichier then
- for ligne in fichier:lines() do
- print(ligne)
- end
- fichier:close()
- else
- print("Erreur. Impossible d'ouvrir le fichier")
- end
- end
- function isValidChoice(choice, validChoices)
- local trouve = false
- for _, valeur in ipairs(validChoices) do
- if valeur == input then
- trouve = true
- break
- end
- end
- return trouve
- end
- choice = "a"
- repeat
- print("\n\n\nTapez une touche pour continuer")
- io.read()
- term.clear()
- print("==========Menu==========\n1) Afficher les ids des satellites\n2) Ajouter un id de satellite\n3) Quitter")
- local choice = io.read()
- local validChoices = {"1", "2", "3"}
- if isValidChoice(choice, validChoices) then
- if choice == "1" then
- display()
- os.sleep(0.1)
- end
- else
- print("Choix invalide, réessaie")
- end
- until choice == "3"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement