Skip to content

Storage

Storage is a regular Lua table containing local data for the current module. It is client-only; the global Storage value is nil in a Reflex server.lua.

Storage has no interface of its own and is not synchronized with the server or other players. Only this module’s code on the current client sees the values; render them through UI or ImGui when the player needs to see them.

While the module runs, Storage is a regular table in its Lua environment. When module state is saved, the client module manager serializes supported values and restores them into a new table on the next load. Unsupported values do not become persistent.

Assignment changes local state only. It does not emit an event, update Config, or notify other code automatically.

if Storage.Settings == nil then
Storage.Settings = {
ShowHints = true,
Scale = 1
}
end
Storage.Settings.Scale = 1.25

Storage is isolated by module. Another module does not receive this table.

Lua value Persisted
string
number
boolean, including false
nested table
nil deletes the key
Vector2, Vector3, Color, and other userdata
function

Unsupported values are silently discarded during serialization.

Store a structure such as Vector3 as separate numbers:

local position = Vector3.new(10, 2, 5)
Storage.Position = {
x = position.x,
y = position.y,
z = position.z
}
local saved = Storage.Position
local restored = Vector3.new(saved.x, saved.y, saved.z)

The game saves Storage when the module is disabled normally and loads it the next time the module is enabled.

Assign nil, then disable the module normally:

Storage.LegacyValue = nil
Storage.OldSettings = nil

The removed keys remain nil after the next enable.

Keep data under one versioned key to make migrations easier:

if Storage.Data == nil or Storage.Data.Version ~= 1 then
Storage.Data = {
Version = 1,
Enabled = true,
Opacity = 0.8
}
end

Storage.Position = Vector3.one works in the live Lua table, but the value disappears during serialization. Convert the vector to a table of numbers.

When false is a valid stored value, distinguish it from a missing key:

if Storage.Enabled == nil then
Storage.Enabled = true
end

Structured values such as Vector2, Vector3, and Color must be stored as number tables.