Advertisement
Clorith

Documentor

Dec 14th, 2014
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. print( "Select location of peripheral" )
  2. local unit = peripheral.wrap( read() )
  3. print( "Peripheral label" )
  4. local perrlabel = read()
  5.  
  6. print( "Writing functions to " .. perrlabel .. " directory" )
  7. returnDir = shell.dir()
  8.  
  9. fs.makeDir( perrlabel )
  10.  
  11. shell.setDir( perrlabel )
  12.  
  13. commands = unit.getAdvancedMethodsData()
  14.  
  15. for key, command in pairs( commands ) do
  16. fw = fs.open( perrlabel .. "/" .. key, "w" )
  17.  
  18. for argnum, argument in pairs( command ) do
  19. if ( "table" == type( argument ) ) then
  20. fw.writeLine( argnum )
  21. fw.writeLine( " " )
  22. for argnum, args in pairs( argument ) do
  23. if "table" == type( args ) then
  24. for a, b in pairs( args ) do
  25. fw.writeLine( a .. ": " .. tostring( b ) )
  26. end
  27. else
  28. fw.writeLine( argnum .. ": " .. args )
  29. end
  30. fw.writeLine( " " )
  31. end
  32. else
  33. fw.writeLine( argnum .. ": " .. tostring( argument ) )
  34. end
  35.  
  36. fw.writeLine( " " )
  37. end
  38. fw.close()
  39.  
  40. print( "Wrote help for " .. key )
  41. end
  42.  
  43. shell.setDir( returnDir )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement