chore: housekeeping

This commit is contained in:
littensy 2026-04-03 07:26:22 -07:00
parent 3134136e70
commit c842926abe
6 changed files with 44 additions and 36 deletions

View file

@ -9,19 +9,22 @@ return {
Whether the history of state changes since the client's last update
should be preserved. This is useful for values that change multiple
times per frame, where each individual change is important. Defaults
to `false`.
to `false` for performance reasons.
]]
preserveHistory = false,
--[[
When `true`, Charm will apply validation and serialize unsafe arrays
to address remote event argument limitations. Defaults to `true`.
When `true`, Charm will modify sparse arrays to prevent data loss from
remote event limitations. When an unsafe array is detected, numeric
indices will be converted to string keys so that the array can be sent
safely and then converted back to an array on the receiving end.
This option should be disabled if your network library uses a custom
serialization method (i.e. Zap, ByteNet) to prevent interference.
]]
fixArrays = true,
--[[
When `true`, synced state containing unsafe sparse arrays or mixed
tables will throw an error. Only checked in strict mode and if
tables will emit a warning. Only checked in strict mode and if
`fixArrays` is enabled. Defaults to `true`.
]]
validatePatches = true,

View file

@ -78,14 +78,17 @@ export const config: {
* Whether the history of state changes since the client's last update
* should be preserved. This is useful for values that change multiple
* times per frame, where each individual change is important. Defaults
* to `false`.
* to `false` for performance reasons.
*
* @server
*/
preserveHistory: boolean;
/**
* When `true`, Charm will apply validation and serialize unsafe arrays
* to address remote event argument limitations. Defaults to `true`.
* When `true`, Charm will modify sparse arrays to prevent data loss from
* remote event limitations. When an unsafe array is detected, numeric
* indices will be converted to string keys so that the array can be sent
* safely and then converted back to an array on the receiving end.
*
* This option should be disabled if your network library uses a custom
* serialization method (i.e. Zap, ByteNet) to prevent interference.
*
@ -94,7 +97,7 @@ export const config: {
fixArrays: boolean;
/**
* When `true`, synced state containing unsafe sparse arrays or mixed
* tables will throw an error. Only checked in strict mode and if
* tables will emit a warning. Only checked in strict mode and if
* `fixArrays` is enabled. Defaults to `true`.
*
* @server
@ -242,7 +245,7 @@ export namespace patch {
* @param statePatch The patches to apply.
* @returns The new state with the patch applied.
*/
export function apply<State, FixArrays extends boolean = true>(
export function applyImmutable<State, FixArrays extends boolean = true>(
currentState: State,
statePatch: SyncPatch<State, FixArrays>,
): State;