Difference between revisions of "CommandBlock.getCommand"
From ComputerCraft Wiki
MKlegoman357 (Talk | contribs) (Added CommandBlock.getCommand) |
MKlegoman357 (Talk | contribs) (Improved) |
||
| Line 2: | Line 2: | ||
|name=commandBlock.getCommand | |name=commandBlock.getCommand | ||
|api=Command Block | |api=Command Block | ||
| − | |returns={{type|string}} command | + | |returns={{type|string}} command currently inside the command block |
|addon=ComputerCraft | |addon=ComputerCraft | ||
|desc=Returns a string containing the command currently inside the Command Block. | |desc=Returns a string containing the command currently inside the Command Block. | ||
|examples={{Example | |examples={{Example | ||
| − | |desc=Prints current command of a command block attached on the | + | |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(" | + | |code=local commandBlock = [[peripheral.wrap]]("left")<br/><br/>print(commandBlock.getCommand()) |
|output=time set 0 | |output=time set 0 | ||
}} | }} | ||
Revision as of 21:36, 31 March 2014
| 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
| 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") |
| Output | time set 0 |