data.patch
Overview
- Apply an in-place data patch at runtime. Reverted on unmodding. QUERY SYNTAX (STRICT): Every bracket selector MUST be Key=Value. Bare-value selectors like Table[Foo] or arr[0] will FAIL to parse. OK: HouseholdBizConfig[Id=Default].baseEmployeeWagePerHour OK: HouseholdBizConfig[Id=Default].householdBizSkillLevelInfo[level=0].baseEmployeeWagePerHour OK: ItemTable[*].price (wildcard over all rows) BAD: HouseholdBizConfig[Default].baseEmployeeWagePerHour BAD: householdBizSkillLevelInfo[0].baseEmployeeWagePerHour COMMON KEYS: Top-level row Id is usually 'Id'. Inner arrays use their own key field (e.g. 'level', 'index', 'tier'). If unsure, fetch the row first via data.table_get and look at which scalar field uniquely identifies each array element. METHODS: Override = replace the value at the path. Append/Insert = list operations. VALIDATION (STRICT): The value is validated against the target schema BEFORE applying. A non-existent field name or a disallowed enum value FAILS with a specific reason (including the list of valid fields / enum values), instead of silently succeeding without any effect. POST-PROCESS (OnPostJsonDataLoad): Append/Insert (single-row) auto-runs OnPostJsonDataLoad on the new row to populate derived fields (e.g. Object.ObjectTags merged from ObjectTemplate). Override/Wildcard does NOT auto-run because re-invoking it on already-processed rows can double-apply non-idempotent merges (e.g. Tags.Append). Pass refresh=true to force OnPostJsonDataLoad on every applied row regardless of method (use sparingly). TEXT (L10N): A field whose name ends with 'TextId' (e.g. DisplayNameTextId) accepts a per-language object instead of a TextId string: value={"ko":"...","en":"..."} (also works for nested fields inside an Append/Insert row value) The texts are registered into a runtime StringTable and the field is set to the generated TextId (mod_<Type>_<hash>). The StringTable type defaults to the table name (e.g. Object); override with text_type or a "_type" key in the object. Pass mod_id to also save the texts into that InGame mod (non_ufs/StringTableExport) so they persist across sessions. The texts are saved only after the patch is applied; a failed patch leaves nothing in the mod folder. The response lists the generated ids in text_ids. COPYING A BASE ROW: data.table_get returns camelCase keys (e.g. displayNameTextId, iD) but Append only accepts the exact PascalCase struct field names (DisplayNameTextId, ID). Capitalize the first letter of every key (nested ones too) before Append; drop 'row_name'; set the new row's Id field (usually 'ID' or 'Id' - an 'Unknown field' error lists the valid names). Then give the copy its own name/description with a per-language object. Never invent a plain TextId string: only 'mod' ids and existing base-game ids resolve; anything else shows <MISSING STRING TABLE ENTRY>. Such strings are not blocked, but the response lists them in text_warnings. Treat any text_warnings entry as a bug and re-patch.
Metadata
| Field | Value |
|---|---|
| Display | Patch DataTable |
| Category | data |
| Access | Public |
| Scope | B1Standalone |
| Tags | — |
| Aliases | — |
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| method | string | yes | — | Override / Append / Insert |
| query | string | yes | — | Patch query path. EVERY bracket MUST be [Key=Value], never [Value] alone. Examples: 'Table[Id=Foo].Field', 'Table[Id=Foo].arr[level=0].sub', 'Table[*].Field' (wildcard). Bare-value forms like Table[Foo] or arr[0] will be rejected by the parser. |
| value | string | yes | — | Value to apply (JSON or plain string) |
| refresh | bool | no | false | Force OnPostJsonDataLoad on every applied row to recompute derived fields. Default false. Append/Insert (single-row) post-processes automatically without this flag. |
| text_type | string | no | — | StringTable type (EB1StringTableType name, e.g. 'Object') for per-language *TextId objects. Defaults to the table name. |
| mod_id | string | no | — | InGame mod id. When set, per-language *TextId objects are also saved into the mod's non_ufs/StringTableExport. |
Returns
- Return shape is not declared for this command.
Usage
await inzoi.cli.execute('data.patch', {
method: '',
query: '',
value: '',
refresh: false, // optional
text_type: '', // optional
mod_id: '', // optional
});