> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rollingquest.kramgames.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ElementPropertyPool — Custom Entity Properties Reference

> API reference for the ElementPropertyPool class in RollingQuest Lua scripting. Query, read, and inspect custom properties attached to entities.

The `ElementPropertyPool` class provides read-only access to the custom properties defined on an entity (block, side, item, enemy, ball, decoration). Custom properties are defined in the level editor and allow designers to attach metadata to entities that scripts can read at runtime.

Every entity exposes a `properties` field of this type.

<Note>
  To modify properties at design time (in level data), use [`ElementPropertiesData`](/api/classes/element-properties-data) instead.
</Note>

## Properties

| Property     | Type       | Read-only | Description                       |
| ------------ | ---------- | --------- | --------------------------------- |
| `count`      | `integer`  | ✅         | Number of properties in the pool. |
| `names`      | `string[]` | ✅         | Array of all property names.      |
| `namesArray` | `string[]` | ✅         | Property names as a native array. |

## Methods

### hasProperty

Checks if a property with the given name exists.

```lua theme={null}
--- @param name string
--- @return boolean
function ElementPropertyPool:hasProperty(name)
```

### getProperty

Returns the property object with metadata.

```lua theme={null}
--- @param name string
--- @return ElementProperty
function ElementPropertyPool:getProperty(name)
```

### getPropertyValue

Returns the current value of a property.

```lua theme={null}
--- @param name string
--- @return DynValue
function ElementPropertyPool:getPropertyValue(name)
```

### Indexer

Direct value access by name:

```lua theme={null}
local value = properties["myProperty"]
```

## ElementProperty

Each property returned by `getProperty()` has:

| Property   | Type                  | Description                             |
| ---------- | --------------------- | --------------------------------------- |
| `info`     | `ElementPropertyInfo` | Metadata about the property definition. |
| `isHidden` | `boolean`             | `true` if hidden from the editor UI.    |
| `type`     | `string`              | Type name of the property value.        |
| `value`    | `DynValue`            | Current value of the property.          |

## ElementPropertyInfo

| Property       | Type       | Description                                             |
| -------------- | ---------- | ------------------------------------------------------- |
| `type`         | `string`   | Data type (e.g., `"integer"`, `"string"`, `"boolean"`). |
| `isHidden`     | `boolean`  | Whether hidden from the editor.                         |
| `name`         | `string`   | Property name.                                          |
| `description`  | `string`   | Human-readable description.                             |
| `defaultValue` | `DynValue` | Default value for this property.                        |
| `enumValues`   | `string[]` | Available values if the property is an enum type.       |

## Usage Example

Read custom properties from a block:

```lua theme={null}
function OnBallRoll(self, rollIn, side, ball)
    -- self is a Block
    local props = self.properties

    if props:hasProperty("speed_multiplier") then
        local speed = props:getPropertyValue("speed_multiplier")
        Logger.info("Speed multiplier: " .. tostring(speed))
    end

    -- List all properties
    for _, name in ipairs(props.names) do
        local prop = props:getProperty(name)
        Logger.info("Property: " .. name .. " = " .. tostring(prop.value) .. " (type: " .. prop.type .. ")")
    end
end
```

Direct indexer access:

```lua theme={null}
function OnBallRoll(self, rollIn, side, ball)
    local damage = self.properties["damage"]
    if damage ~= nil then
        Logger.info("Damage: " .. tostring(damage))
    end
end
```
