Commandblock API

From ComputerCraft
Jump to navigation Jump to search
Error creating thumbnail: Unable to save thumbnail to destination
Functioncommandblock.getCommand
Returns the command from a commandblock. Note Note: The commandblock peripheral is disabled by default. You have to enable it in the config before using it.
Syntax commandblock.getCommand()
Returns string command
Part of CC:Tweaked (source)
API commandblock
Error creating thumbnail: Unable to save thumbnail to destination
ExampleGet command
Get Command and print it.
Code
local commandblockr = peripheral.find("command")
print(commandblock.getCommand())
Output
kill @a


Error creating thumbnail: Unable to save thumbnail to destination
Functioncommandblock.runCommand
Run a command from a commandblock. Note Note: The commandblock peripheral is disabled by default. You have to enable it in the config before using it.
Syntax commandblock.runCommand()
Returns boolean success string error
Part of CC:Tweaked (source)
API commandblock
Error creating thumbnail: Unable to save thumbnail to destination
ExampleRun command
Run command.
Code
local commandblock = peripheral.find("command")
print(commandblock.runCommand())
Output
true


Error creating thumbnail: Unable to save thumbnail to destination
Functioncommandblock.setCommand
Set the command of a commandblock. Note Note: The commandblock peripheral is disabled by default. You have to enable it in the config before using it.
Syntax commandblock.setCommand()
Returns nil
Part of CC:Tweaked (source)
API commandblock
Error creating thumbnail: Unable to save thumbnail to destination
ExampleSet command
Set command.
Code
local commandblock = peripheral.find("command")
commandblock.setCommand("kill @a")