Roachy, on 06 May 2013 - 04:59 PM, said:
Is there a way to view the individual peripheral's API code? It would at least be helpful in lieu of explicit documentation. I don't mean to sound snarky or anything, I love all the things this mod brings. It's just frustrating not knowing how to use some of this stuff.
I found this script very handy for retrieving the methods of peripherals:
ok=false
tArgs = { ... }
if #tArgs > 0 then
side = tArgs[1]
if side ~="bottom" and side~="top" and side~="right" and side~="left" and side~="back" and side~="front" then
print("Invalid side valid sides are: top, bottom, left, right, back, front")
else
ok = true
end
if ok == true then
if peripheral.isPresent(side) == true then
methods=peripheral.getMethods(side)
print("Methods for "..peripheral.getType(side)..":")
for k, v in pairs(methods) do
print("Method["..k.."]="..v)
end
else
print("No peripheral on "..side.." side")
end
end
else
print("Usage: methods <side>")
end
I didn't write this and it's a fair old amount of time since I found it and as such I cannot recall who did write it, but all credit goes to them...