Advertisement
Tomyf4

ApiCalls

Feb 11th, 2024
14
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. -- Wrap the peripheral behind the computer
  2. local peripheralSide = "back" -- Adjust as needed
  3. local wrappedPeripheral = peripheral.wrap(peripheralSide)
  4.  
  5. -- Check if the peripheral is available
  6. if wrappedPeripheral == nil then
  7. print("Peripheral on side " .. peripheralSide .. " not found!")
  8. return
  9. end
  10.  
  11. -- Function to print functions in batches
  12. local function printFunctionsInBatches(peripheralFunctions)
  13. local batchSize = 10
  14. local totalFunctions = #peripheralFunctions
  15.  
  16. for i = 1, totalFunctions, batchSize do
  17. for j = i, math.min(i + batchSize - 1, totalFunctions) do
  18. print(j .. ". " .. peripheralFunctions[j])
  19. end
  20.  
  21. if i + batchSize <= totalFunctions then
  22. print("Press any key to continue...")
  23. os.pullEvent("key")
  24. end
  25. end
  26. end
  27.  
  28. -- Get a list of all available functions
  29. local allFunctions = {}
  30. for functionName, _ in pairs(wrappedPeripheral) do
  31. table.insert(allFunctions, functionName)
  32. end
  33.  
  34. -- Print functions in batches
  35. printFunctionsInBatches(allFunctions)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement