chore: housekeeping

This commit is contained in:
littensy 2026-04-19 18:46:17 -07:00
parent 6a4b2ded3e
commit 71d155e947
11 changed files with 49 additions and 86 deletions

View file

@ -90,7 +90,7 @@ end
@param payloads The state updates received from the server.
]]
local function patch(payloads: { SyncPayload })
local function applyPatches(payloads: { SyncPayload })
for _, payload in payloads do
if payload.type == "init" then
Charm.batch(applyInitPayload, payload.data)
@ -104,5 +104,5 @@ return {
addSignals = addSignals,
removeSignals = removeSignals,
removeAllSignals = removeAllSignals,
patch = patch,
patch = applyPatches,
}

View file

@ -39,9 +39,9 @@ local syncCallback: ((client: any, payloads: { SyncPayload }) -> ())?
support custom implementations of reactive proxies.
]]
local function toRaw<T>(value: T): T
local value: any = value
value = value :: types.ReactiveProxy<T>
if type(value) == "table" and type(value.__target) == "table" and type(value.__track) == "function" then
(value.__track :: () -> ())()
value.__track()
return toRaw(value.__target)
end
return value

View file

@ -1,11 +1,11 @@
local function isTableUnsafe(object: { [any]: any })
local key = next(object)
local firstKey = next(object)
if key == nil then
if firstKey == nil then
return false
end
local keyType = type(key)
local keyType = type(firstKey)
local maxKey = 0
-- Keys must all be the same type
@ -35,8 +35,7 @@ end
local function validate(value: { [any]: any })
if isTableUnsafe(value) then
warn(
`Cannot sync tables unsupported by remote events! See the table below for more info.\n\n`
.. "This can be for the following reasons:\n"
"Cannot sync tables unsupported by remote events! This can be for the following reasons:\n"
.. "1. The table is a sparse array with non-sequential indices\n"
.. "2. The table is a mixed table (not all keys have the same type)\n\n"
.. "Read more: https://create.roblox.com/docs/scripting/events/remote#argument-limitations\n",