> ## 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.

# MessageData — Localized Message Reference

> API reference for the MessageData class in RollingQuest Lua scripting. Read localized text messages used in level scripts.

The `MessageData` class represents a localized text message entry in the level data system. Messages are named text resources that can be translated into multiple languages. You access existing messages via `LevelData.getMessage(name)`.

## Properties

| Property | Type     | Read-only | Description                       |
| -------- | -------- | --------- | --------------------------------- |
| `name`   | `string` | ✅         | Unique identifier of the message. |

## Methods

### GetText

Returns the text for a specific language.

```lua theme={null}
--- @param language string
--- @return string
function MessageData:GetText(language)
```

### GetAvailableLanguages

Returns a table of all languages that have text set for this message.

```lua theme={null}
--- @return Table
function MessageData:GetAvailableLanguages()
```

## Usage Example

Read a message and display it:

```lua theme={null}
function OnStart(self)
    if Level:hasMessage("welcome") then
        local msg = Level:getMessage("welcome")
        local text = msg:GetText("en")
        Dialog.createTemporary(text, 3)
    end
end
```

Check available languages:

```lua theme={null}
function OnStart(self)
    local msg = Level:getMessage("objective")
    local languages = msg:GetAvailableLanguages()

    for _, lang in ipairs(languages) do
        Logger.info(lang .. ": " .. msg:GetText(lang))
    end
end
```
