mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Refactor service encoding to conditionally include properties, attributes, tags, and references
- Updated the `encodeService` function to return a more concise result object by conditionally including properties, attributes, tags, and references only if they are present. - This change enhances the efficiency of the encoding process by reducing unnecessary data in the output, improving overall performance during syncback operations.
This commit is contained in:
parent
c3cb9b4b98
commit
8070129bca
1 changed files with 16 additions and 5 deletions
|
|
@ -90,12 +90,23 @@ return function(service: Instance)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
local result = {
|
||||||
className = service.ClassName,
|
className = service.ClassName,
|
||||||
data = data,
|
data = data,
|
||||||
properties = properties,
|
|
||||||
attributes = attributes,
|
|
||||||
tags = tags,
|
|
||||||
refs = refs,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if next(properties) then
|
||||||
|
result.properties = properties
|
||||||
|
end
|
||||||
|
if next(attributes) then
|
||||||
|
result.attributes = attributes
|
||||||
|
end
|
||||||
|
if #tags > 0 then
|
||||||
|
result.tags = tags
|
||||||
|
end
|
||||||
|
if next(refs) then
|
||||||
|
result.refs = refs
|
||||||
|
end
|
||||||
|
|
||||||
|
return result
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue