entitydef
World & Entities
4 Properties
3 Methods
entitydef
The entitydef class represents entity blueprint definitions registered in def.* tables. Provides lookups by ID and localized names.
Overview
Properties (4)
| Property | Type | Summary |
|---|---|---|
id
|
string
|
Unique definition string ID. |
index
|
number
|
Internal index of the definition. |
isValid
|
boolean
|
Checks if definition is valid. |
name
|
string
|
Localized display name. |
Methods (3)
| Method Signature | Returns | Summary |
|---|---|---|
entitydef.exists(id)
|
boolean
|
Checks if an entity definition ID exists. |
entitydef.getName(id)
|
string
|
Gets the localized name for an entity definition ID. |
entitydef.new(id)
|
entitydef
|
Looks up an entity definition by ID. |
Detailed Reference
entitydef.id
Unique definition string ID.
Parameters
None
Returns
stringUnique identifier string.
Description
The string identifier used in definitions (e.g. "stone", "palm_tree", "machete").
entitydef.index
Internal index of the definition.
Parameters
None
Returns
numberInternal integer index.
Description
Fast integer lookup index.
entitydef.isValid
Checks if definition is valid.
Parameters
None
Returns
booleanTrue if definition exists.
Description
Returns true if the definition exists in the registry.
entitydef.name
Localized display name.
Parameters
None
Returns
stringLocalized display name.
Description
Returns the translated display name for the entity type.
entitydef.exists(id)
Checks if an entity definition ID exists.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
id | string | Definition string ID. |
Returns
booleanTrue if definition exists.
Description
Returns true if id is registered in the game definitions.
entitydef.getName(id)
Gets the localized name for an entity definition ID.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
id | string | Definition string ID. |
Returns
stringLocalized name.
Description
Convenience lookup for the translated name of id.
entitydef.new(id)
Looks up an entity definition by ID.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
id | string | Definition string ID. |
Returns
entitydefDefinition descriptor.
Description
Returns the entitydef descriptor matching id.
local def = entitydef.new("fiber")