Jump to content

Peripheral API browser

peripheral help utility

2 replies to this topic

#1 Magik6k

  • Members
  • 29 posts

Posted 02 February 2014 - 09:35 PM

Today I was creating something based on OpenPeripheral, and I could not reach documentation of it, so I looked at 'getAdvancedMethodsData' function. After few minuets I have created small program that makes the data readable.


Pastebin way:
pastebin get yDLNKM1g perihelp

CCPT way:
ccpt ppa add sysx
ccpt install perihelp


perihelp [side]
ex. 'perihelp right'


Up, Down arrow - move up/down one line
Left,Right arrow - move up/down one 'page'
mouse scroll - also move
'q' - quit


Posted Image

Posted Image


#2 surferpup

  • Members
  • 286 posts
  • LocationUnited States

Posted 02 February 2014 - 09:39 PM

This looks pretty cool. If I understand correctly -- it only works with peripherals that have implemented getAdvancedMethods() -- yes?

#3 ingie

  • Members
  • 69 posts
  • LocationMannin

Posted 02 February 2014 - 10:43 PM

nice work

further to this and the OpenPeripheral's thread discussion on the same, I was looking at this: http://regex.info/blog/lua/json

using that, i've tested its use on the getAdvancedMethodsData call - my current hacking of this is simply
local JSON = (loadfile "disk/JSON.lua")()  -- replace this with wherever you save the above linked JSON.lua utility

local chest = peripheral.wrap("left")

local ed = chest.getAdvancedMethodsData()

local myTableJSON = JSON:encode_pretty(ed)


which seems to do the job nicely...

my thoughts on this are that this JSON data is simple to pass via a HTTP request to some javascript to auto-generate a webpage as suggested in the OpenPeripherals thread by NeverCast.

all that is needed to be done now is write the javascript decoding at the other end to make it readable - which should be trivial in JQuery - and an advanced function would be for the page to cache already defined methods, but it'd need to make some checksum etc - probably pass the CC version or something too...

i also found this on the FTB forums


which dumps the method docs to a file for later reading... which is a nice idea

Edited by ingie, 02 February 2014 - 10:44 PM.

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users