CommandBlock.runCommand

From ComputerCraft Wiki
Jump to: navigation, search
Grid Redstone.png  Function commandBlock.runCommand
Runs the command inside the Command Block previously set by manually editing it or by using commandBlock.setCommand(). In case of error, returns false + an error message error.
Syntax commandBlock.runCommand()
Returns boolean success [, string error]
Part of ComputerCraft
API Command Block

Examples

Grid paper.png  Example
Sets the command to toggledownfall and runs it (assuming the Command Block is on the left of the Computer).
Code
local commandBlock = peripheral.wrap("left")

commandBlock.setCommand( "toggledownfall" )
commandBlock.runCommand()