commands.getBlockInfo
From ComputerCraft Wiki
Revision as of 13:00, 16 February 2015 by Bomb Bloke (Talk | contribs) (Created page with "{{lowercase}} {{Function |name=commands.getBlockInfo |args={{type|number}} x, {{type|number}} y, {{type|number}} z |returns={{type|table}} block info |api=commands |addon=Comp...")
Available only to Command Computers, returns a table containing information on the block at the specified world co-ordinate, formatted as follows:
{
name = string block's name,
metadata = number block's metadata
}
The block inspected will be in the same dimension as the computer. This function yields until the data is available to be returned. See also: Data Values @ MineCraft wiki | |
| Syntax | commands.getBlockInfo(number x, number y, number z) |
| Returns | table block info |
| Part of | ComputerCraft |
| API | commands |
Examples
| Prints the facing of the Command Computer running the script by inspecting its own metadata. | |
| Code |
local directions = {"unknown", "north", "south", "west", "east"}
local info = commands.getBlockInfo( commands.getBlockPosition() )
print( "My facing is ", directions[ info.metadata ], "." )
|
| |
|---|
| commands.exec - commands.execAsync - commands.list - commands.getBlockPosition - commands.getBlockInfo - commands.getBlockInfos |