peripheral.getMethods
Returns a table listing the names of all the methods (roughly, operations it is capable of doing) supported by a given peripheral. Any of the methods it lists can be called using the peripheral object returned by peripheral.wrap and peripheral.find, or using peripheral.call, for the given peripheral.
|
|||
This prints all the methods of whatever peripheral is on the left of the computer this is run on. You can replace "left" with another side or a peripheral's network name to list its methods instead | |||
Code | <nowiki>
for _, method in pairs(peripheral.getMethods "left") do
print(method)
end
</nowiki>
|
||
Output | Depends on the peripheral on the left. If there is none it will error. As an example, for a modem, the methods it lists will include transmit, isOpen, isWireless, open, close, and closeAll. |
peripheral.getMethods Function | |
---|---|
Syntax peripheral.getMethods(
| |
Returns | table |
API | peripheral |
Source | CC:Tweaked (source) |
This article is issued from Computercraft. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.