Commands API

From ComputerCraft
Jump to: navigation, search
FunctionFunctioncommands.exec
Execute a Command and wait until the command is finished.
Syntax commands.exec()
Returns boolean sucess table output
Part of CC:Tweaked (source)
API commands
ExampleExampleExecute a Command
Execute a Command
Code
commands.exec("kill @p")


FunctionFunctioncommands.execAsync
Execute a Command but does not yield.
Syntax commands.execAsync()
Returns number taskID
Part of CC:Tweaked (source)
API commands
ExampleExampleExecute a Command
Execute a Command
Code
commands.execAsync("kill @p")

Commands.getBlockInfo Commands.getBlockInfos

FunctionFunctioncommands.getBlockPosition
Return the location of the running Command Computer.
Syntax commands.getBlockPosition()
Returns number x number y number z
Part of CC:Tweaked (source)
API commands
ExampleExampleGet the Position
Get the Position of the Computer and print it
Code
local x, y, z = commands.getBlockPosition()
print("X:"..x.." Y:"..y.." Z:"..z)
Output
X:10 Y:100 Z:50

Commands.list