Skip to main content
Scripts often need to remember things — how many enemies the player has defeated, whether a secret door has been opened, or a score multiplier set in an earlier level. RollingQuest gives you two storage layers to cover both use cases: level-local data that lives for the duration of the current level session, and campaign-global data that persists across all levels in a campaign.

Storage Layers at a Glance

Both are accessed from any script in the level without importing anything.

Level-Local Data: Level.localData

Level.localData is a RawLocalData instance scoped to the current level. Values written here are available to every script running in the same level session, but they do not carry over to the next level. Use Level.localData to share state between multiple scripts within one level — for example, a counter that several block scripts all read and write.

Reading and Writing with RawLocalData

RawLocalData provides strongly-typed getter and setter methods. Each method accepts a key string and works with a specific Lua type.

Checking and Deleting Keys


Campaign-Global Data: Level.campaignGlobalData

Level.campaignGlobalData is a LocalData instance that persists for the lifetime of the entire campaign. Any value you write here in level 1 is still readable in level 5. Use it to track campaign-wide progress, unlock states, or accumulated scores. LocalData exposes the same typed API as RawLocalData — the same setBool, getInteger, setString, and related methods — so everything you learned above applies here too.
Level.campaignGlobalData is only meaningful when the level is played inside a campaign. If the level runs standalone, the data still works but will not persist between separate play sessions.

Structured Data: LocalArray and LocalObject

For more complex payloads you can create LocalArray and LocalObject instances. Both support the same value types: nil, number, string, boolean, nested LocalArray, and nested LocalObject.

LocalArray

A LocalArray is an ordered list you can use like a Lua table with integer keys.
Store and retrieve an array in level-local data:

LocalObject

A LocalObject is a key-value map with string keys — similar to a Lua table, but designed to work with the data storage system.
Store the whole object:

Sharing Data Between Scripts

Because Level.localData is global to the entire level, any script can read what another script wrote. This makes it easy to coordinate state across entity scripts without using signals.
1

Script A writes a value

2

Script B reads the value


Quick Reference

Prefix your keys with a unique identifier (like the entity name or script role) to avoid accidental collisions when multiple scripts use the same storage instance.