Skip to content

#merge_folder

Grisgram edited this page Oct 3, 2025 · 12 revisions

Description

The #merge_foldercommand works very similar to the #join command,
but instead of referencing individual structs or arrays, it merges all files contained in a referenced folder into a single struct.

Syntax

mem: { "key": "#merge_folder:<path>" }
key: no implementation

Param(s)

path: Define which folder is going to be merged like 'path/to/folder'.

Example

Before Apply

// For the sake of simplicity:
// Let's assume that the folder named 'normal_spider' located in 'monsters'
// contains the following files:
// - definition.json
{
    "name": "=lg/path/to/name",
    "aggro_range": 50
}
// - skin.json
{
    "sprite_index": "#asset:sprNormalSpiderIdle",
    "image_xscale": 0.8,
    "image_yscale": 0.8
}
// - stats.json
{
    "base_stats": {
        "level": 5,
        "max_level": 40,
        "hp": 20,
        "max_hp": 90,
        "move_speed": 8
    }
}

// And here is the master file that merges the folder:
{ // <-- root
    "normal_spider": "#merge_folder:monsters/normal_spider",
}

After Apply

Note

This is only a simplified example, not a best-practice guide.
There are usually better ways to structure and manage your data, depending on your use case.

{
    "normal_spider": {                                  // "#merge_folder:monsters/normal_spider"
        "name": "=lg/path/to/name",
        "aggro_range": 50,
        "sprite_index": _sprite id_,
        "image_xscale": 0.8,
        "image_yscale": 0.8,
        "base_stats": {
            "level": 5,
            "max_level": 40,
            "hp": 20,
            "max_hp": 90,
            "move_speed": 8
        }
    }
}

Author’s Recommendation: next read #func

Clone this wiki locally