Get block configuration||doc135411

September 20, 2022


  • The class to which the function belongs:Block


Get block configuration information by block name, usually used to register block events for such blocks.


Variable name type Description
name string block name

Value Returned

type Description
config Block configuration information

Code Samples

Find the block you want to get in the compiler, copy its id


Paste the copied id and add "myplugin/" in front of it to get the name of the block

Use the block name on the serverglobal script, register when the corresponding block is clickedCallback, print out

local cfg = Block.GetNameCfg("myplugin/stone")
Trigger.RegisterHandler(cfg, "BLOCK_CLICK", function(context)
    local clicker = context.obj1
    print("click grass block !",