attributedef
Definitions & Systems
3 Properties
1 Methods
attributedef
The attributedef class represents attribute type descriptors used in the entity stat and attribute system.
Overview
Properties (3)
| Property | Type | Summary |
|---|---|---|
id
|
string
|
Attribute string ID. |
index
|
number
|
Internal index of attribute. |
isValid
|
boolean
|
Checks if attribute definition is valid. |
Methods (1)
| Method Signature | Returns | Summary |
|---|---|---|
attributedef.new(id)
|
attributedef
|
Looks up an attribute definition by string ID. |
Detailed Reference
attributedef.id
Attribute string ID.
Parameters
None
Returns
stringAttribute string ID.
Description
Unique attribute identifier (e.g. "health", "hunger", "thirst", "stamina").
attributedef.index
Internal index of attribute.
Parameters
None
Returns
numberInternal integer index.
Description
Fast integer lookup index.
attributedef.isValid
Checks if attribute definition is valid.
Parameters
None
Returns
booleanTrue if attribute definition exists.
Description
Returns true if the attribute definition is registered.
attributedef.new(id)
Looks up an attribute definition by string ID.
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
id | string | Attribute string identifier. |
Returns
attributedefAttribute descriptor.
Description
Returns the descriptor matching id.
local healthAttr = attributedef.new("health")