Advertisement
Daraketh

API printer

Jul 6th, 2014
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.66 KB | None | 0 0
  1. h = fs.open("meAPI", "w")
  2.  
  3. function tprint (tbl, indent)
  4.  
  5.   if not indent then indent = 0 end
  6.  
  7.   for k, v in pairs(tbl) do
  8.  
  9.     formatting = string.rep("  ", indent) .. k .. ": "
  10.  
  11.     if type(v) == "table" then
  12.       print(formatting)
  13.       h.writeLine(formatting)
  14.       tprint(v, indent+1)
  15.     elseif type(v) == 'boolean' then
  16.       print(formatting .. tostring(v))
  17.       h.writeLine(formatting .. tostring(v))
  18.     else
  19.       print(formatting .. v)
  20.       h.writeLine(formatting .. v)
  21.     end
  22.  
  23.     sleep(0.10)
  24.     --read()
  25.  
  26.   end
  27.  
  28. end
  29.  
  30. meINT = peripheral.wrap("left")
  31.  
  32. data = meINT.getAdvancedMethodsData()
  33.  
  34. tprint(data, 0)
  35.  
  36. h.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement