Difference between revisions of "CommandBlock.getCommand"
From ComputerCraft Wiki
MKlegoman357 (Talk | contribs) (Improved) |
MKlegoman357 (Talk | contribs) m (Improved example) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Function | {{Function | ||
− | |name=commandBlock.getCommand | + | |name=''commandBlock''.getCommand |
|api=Command Block | |api=Command Block | ||
|returns={{type|string}} command currently inside the command block | |returns={{type|string}} command currently inside the command block | ||
Line 7: | Line 7: | ||
|examples={{Example | |examples={{Example | ||
|desc=Prints current command of a command block attached on the left side of the computer (assuming the command is ''time set 0''). | |desc=Prints current command of a command block attached on the left side of the computer (assuming the command is ''time set 0''). | ||
− | |code=local commandBlock = [[peripheral.wrap]]("left") | + | |code= local commandBlock = [[peripheral.wrap]]("left") |
+ | |||
+ | [[print]]( '''commandBlock.getCommand()''' ) | ||
|output=time set 0 | |output=time set 0 | ||
}} | }} |
Latest revision as of 19:26, 16 February 2015
Function commandBlock.getCommand | |
Returns a string containing the command currently inside the Command Block. | |
Syntax | commandBlock.getCommand() |
Returns | string command currently inside the command block |
Part of | ComputerCraft |
API | Command Block |
Examples
Example | |
Prints current command of a command block attached on the left side of the computer (assuming the command is time set 0). | |
Code |
local commandBlock = peripheral.wrap("left") print( commandBlock.getCommand() ) |
Output | time set 0 |