object configuration||doc135423

September 20, 2022

Format

 Object:cfg() 
  • The class to which the function belongs:Object

Description

Get object configuration information, usually used to register trigger handlers for objects.


Value Returned

type Description
config configuration information


Code Samples

on the server sideglobal script, spawning an entity and registering it on deathCallback

local createParams = { cfgName = "myplugin/entity", pos = { x = 24, y = 53, z = 50 } }
local entity = EntityServer.Create(createParams)
Trigger.RegisterHandler(entity:cfg() , "ENTITY_DIE", function(context)
    local dead = context.obj1
    print(dead.name)
end)