Skip to content

Storage

PxIgnis provides persistent JSON key-value storage for global and per-player data. Data is saved automatically on server stop, player disconnect, and /ignis reload.

Right now it uses JSON as the storage backend. In the future it may support real databases (SQLite/Posgtres/MySQL) without the API changes. And maybe we’ll have an sqlite lib.

ScopeFile
Globalconfig/ignis/storage/global.json
Per-playerconfig/ignis/storage/players/<uuid>.json
-- Global data (available everywhere)
mc.data.key = "value"
local v = mc.data.key
-- Per-player data (in command/event handlers)
ctx.player.data.coins = 100
local coins = ctx.player.data.coins

Supports numbers, strings, booleans, tables, and nil (deletes the key).

Deep writes work directly — no special workaround needed:

-- This persists on save:
data.stats.kills = 5
data.stats.name = "player_stats"

The following types are not allowed in storage and will raise an error:

  • Functions
  • Userdata
  • Threads
  • Tables with cyclic references

Data is written to disk on:

  • Server stop
  • Player disconnect (per-player data only)
  • /ignis reload

Per-player data is removed from the in-memory storage map on disconnect (but remains on disk).

All file writes use an atomic write pattern: data is written to a temporary file first, then atomically moved to the target path. This prevents data corruption if the server crashes mid-write.