Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Types

Sora type expressions are written as strings in schema fields.

Primitive Types

TypeMeaning
boolBoolean value.
i88-bit signed integer.
u88-bit unsigned integer.
i1616-bit signed integer.
u1616-bit unsigned integer.
i3232-bit signed integer.
u3232-bit unsigned integer.
i6464-bit signed integer.
f3232-bit floating point value.
f6464-bit floating point value.
stringUTF-8 string.
durationNon-negative duration written as units such as 500ms, 30s, 15m, 2h, 7d, or 1h 30m. Units must be ordered from largest to smallest: d, h, m, s, ms. Runtime data stores milliseconds.
textLocalization text key. See Localization.

Integer widths are validated by Sora before export. Some target languages do not have unsigned small integer types, so generated code may use a wider signed type while preserving the schema range.

[[tables.fields]]
name = "level"
type = "u16"
range = [1, 100]

Named Types

TypeExample
Enumenum<ItemType>
Structstruct<ResourceCost>
Unionunion<RewardAction>
Referenceref<Item.id>

References must point to the primary key of a mode = "map" table. Containers can wrap references, for example list<ref<Item.id>>.

[[tables.fields]]
name = "item_type"
type = "enum<ItemType>"

[[tables.fields]]
name = "price"
type = "struct<ResourceCost>"
parser = { kind = "tuple" }

Collections

TypeMeaning
list<T>Ordered repeated values.
set<T>Unique repeated values.
array<T,N>Fixed-length repeated values.
map<K,V>Key/value pairs.
optional<T>Nullable or absent value.
[[tables.fields]]
name = "tags"
type = "set<string>"
parser = { kind = "json" }
default = "[\"misc\"]"

[[tables.fields]]
name = "attributes"
type = "map<string,i32>"
parser = { kind = "map" }

Cell Examples

These examples show what a designer would put in an Excel or CSV cell:

Field typeParserCell value
u16none1001
enum<ItemType>noneWeapon
list<i32>none or split1,2,3
durationnone1h 30m
textnonequest.1001.title
set<string>json["starter","melee"]
struct<ResourceCost>tupleGold,0,100
struct<ResourceCost>columnsspread across cost_kind, cost_id, cost_count columns
map<string,i32>mapatk,10|hp,20
union<EventCondition>json{"type":"QuestCompleted","quest_id":5002}
optional<ref<Item.id>>noneempty cell or 1001

Field Rules

[[tables.fields]], [[structs.fields]], and [[unions.variants.fields]] share the common field properties. Table fields have extra table-only properties for derived values; those properties are invalid on struct fields and union variant fields. A table primary key is declared once on the table itself with key = "field_name".

Field presence is part of the type: optional<T> means the value may be absent or null, while every other type is required unless a default fills the missing value.

For TOML/JSON/YAML-style object inputs, a field can be absent from the object. For Excel and CSV, the column must exist in the header; an omitted cell, blank cell, or short CSV record is treated as an empty cell.

Schema fieldObject field absentExcel/CSV cell empty
type = "i32"Validation error.Validation error.
type = "optional<i32>"null.null.
type = "i32" plus default = "1"1.1.
type = "optional<i32>" plus default = "1"1.null.
PropertyApplies ToPurpose
nameall fieldsField name used in source data, validation errors, generated code, and exported runtime data.
typeall fieldsType expression such as i32, struct<ResourceCost>, or list<union<RewardAction>>.
defaultall fields except derived fieldsString value used when the source object field is absent or a required Excel/CSV cell is empty.
commentall fieldsDescription used in generated Excel headers.
rangenumeric fields, duration, and collection elements of those typesInclusive numeric range, written as [min, max]. Duration ranges are milliseconds.
lengthstring, list, set, array, mapInclusive length range, written as [min, max].
parsercell-based inputs and defaultsCell parser hint. See Cell Parsers.
scopeall fieldsIncludes the field only for selected generation/export scopes. Defaults to all.
fromtable fields onlyOptional child-table source for a derived field.

Defaults are written as strings because they are parsed through the same type-aware conversion path as source data.

from describes a field derived from matching rows in another table; see References and Derived Fields. Derived fields can be list<T>, T, or optional<T> and cannot declare default.