Command Block (API)
From ComputerCraft Wiki
Revision as of 06:10, 30 March 2013 by Negamartin (Talk | contribs)
The Command Block API allows you to run commands in a Command Block, using it as a peripheral. (The peripheral can only be used if allowed in the config, which is default to false)
Functions exposed by the Command Block:
| Function | Description |
|---|---|
| getCommand( ) | Returns a string containing the command currently inside the Command Block. |
| setCommand( string command ) | Sets the command in the Command Block. This does not run it. |
| runCommand( ) | Runs the command inside the Command Block previously set by setCommand( ) |
Note
All Command Block functions are to be used after wrapping the block in a peripheral. example:
command = peripheral.wrap("left")
command.setCommand("time set 1000")
command.runCommand()
local currentCommand = command.getCommand()