diff --git a/getMethodsPeripheral.lua b/getMethodsPeripheral.lua new file mode 100644 index 0000000..0c3b2f8 --- /dev/null +++ b/getMethodsPeripheral.lua @@ -0,0 +1,24 @@ +-- ask direction to get methods of a peripheral +print("Enter the direction of the peripheral (left, right, top, bottom, front, back):") +local direction = io.read() +if not direction or direction == "quit" or direction == "exit" then + print("No direction specified, exiting.") + return +end +local info = {} + +info = peripheral.getMethods(direction) + +-- list the methods from info + +local nbOfMethods = 0 +for methodName, methodInfo in pairs(info) do + nbOfMethods = nbOfMethods + 1 + if nbOfMethods > 10 then + print("Too many methods, please press a key to continue...") + event, p1 = os.pullEvent("key") + nbOfMethods = 0 + term.clear() + end + print(methodName .. ' ' .. methodInfo) +end diff --git a/update.lua b/update.lua index 290249c..d92aaed 100644 --- a/update.lua +++ b/update.lua @@ -18,7 +18,7 @@ local fileToUpdate = io.read() -- Lire l'entrée de l'utilisateur fileToUpdate = fileToUpdate:gsub(" ", "_") -- Vérifier que l'utilisateur a bien entré quelque chose if fileToUpdate == nil or fileToUpdate == "" then - print("Aucune destination spécifiée, utilisation du nom par défaut: script.lua") + print("Aucune destination spécifiée, sortie du programme.") return end if fileToUpdate == "exit" or fileToUpdate == "quit" then