get block id||doc135410

September 20, 2022

Format

 Block.GetNameCfgId(name)
  • The class to which the function belongs:Block

Description

Get block id by block name.


Precautions

  • The block name can be obtained by right-clicking the specific block in the editor's block component library, copying the ID and adding it in front“myplugin/“

Parameters

Variable name type Description
name string block name


Value Returned

type Description
int BlockId


Code Samples

Get the block ID of the grass block

local blockId = Block.GetNameCfgId("myplugin/grass")