Ubidibity

tester from github

Jun 9th, 2022 (edited)
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.30 KB | Source Code | 0 0
  1. -- Simple script to display the type and methods a device has.
  2. -- Place script advanced computer
  3. -- Place computer so that device is on the computers back side
  4. -- Run script.
  5. -- Profit
  6.  
  7. -- You will also find additional details in a file found in:
  8. -- [Minecraft Directory]/saves/[World Name]/computer/[Int]/[devicetype]
  9.  
  10. -- label set Tester
  11. -- pastebin get WdiT6sR5 bootstrap
  12. -- bootstrap
  13. -- github get coolacid/ComputerCraft/master/tester.lua tester
  14.  
  15. function dump(t, level)
  16.   level = level or 0
  17.   for i,v in pairs(t) do
  18. --    io.write(string.rep('  ', level))
  19. --    io.write(i..': ')
  20.     file.write(string.rep('  ', level))
  21.     file.write(i..': ')
  22.     if type(v) == 'table' then
  23. --      print ''
  24.       file.writeLine("")
  25.       dump(v, level + 1)
  26.     else
  27. --      print(tostring(v))
  28.       file.writeLine (tostring(v))
  29.     end
  30.   end
  31. end
  32.  
  33. device = peripheral.getType("back")
  34.  
  35. if device then
  36.   me = peripheral.getMethods("back")
  37.   file = fs.open(device, "w")
  38.   print(device)
  39.   file.writeLine(device)
  40.   for k,v in pairs (me) do
  41.     print (k .. " | " .. v)
  42.     file.writeLine (k .. " | " .. v)
  43.   end
  44.   item = peripheral.wrap("back")
  45.   amd = item.getAdvancedMethodsData()
  46.   dump(amd)
  47.   file.flush()
  48.   file.close()
  49.   print ("Addtional data saved to file")
  50. else
  51.   print("No methods")
  52. end
Add Comment
Please, Sign In to add comment