Advertisement
giwdul

test_function_tom's_SS_CC

Jan 14th, 2024 (edited)
1,410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.99 KB | Source Code | 0 0
  1. p = peripheral.wrap("left")
  2.  
  3. while true do
  4.     print("Veuillez sélectionner une fonction:")
  5.     print("1. getItemDetail")
  6.     print("2. list")
  7.     print("3. size")
  8.     print("4. Quitter")
  9.  
  10.     local choix = read()
  11.  
  12.     if choix == "1" then
  13.         print("Entrez l'index de l'élément pour getItemDetail:")
  14.         local index = tonumber(read())
  15.         local detail = p.getItemDetail(index)
  16.         if detail then
  17.             for k, v in pairs(detail) do
  18.                 print(k, v)
  19.             end
  20.         else
  21.             print("Aucun détail trouvé pour l'index spécifié.")
  22.         end
  23.     elseif choix == "2" then
  24.         local liste = p.list()
  25.         for k, v in pairs(liste) do
  26.             print(k, v)
  27.         end
  28.     elseif choix == "3" then
  29.         local taille = p.size()
  30.         print("Taille :", taille)
  31.     elseif choix == "4" then
  32.         print("Programme terminé.")
  33.         break
  34.     else
  35.         print("Choix non valide, veuillez réessayer.")
  36.     end
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement