core.engine.get_entity_by_net_id
Shared
Retrieves a registered entity instance by its network identifier
Syntax
local result = core.engine.get_entity_by_net_id(net_id)Parameters
| Type | Name | Description |
|---|---|---|
int | net_id | Network identifier of the target entity Must be a positive integer assigned by the network manager |
Returns
| Type | Name | Description |
|---|---|---|
entity | bool | result | Entity instance matching the given net_id, or false otherwise |
Examples
local net_id = 1001
local entity = core.engine.get_entity_by_net_id(net_id)
if entity then
core.engine.print("info", "Retrieved entity:", entity, string.format("(%s)", entity:get_type()))
else
core.engine.print("warn", "No entity found for net_id:", net_id)
end