Differences from Squash?
This is largely similar to the Squash (it is a fork, after all). Only the important differences will be listed below.
General Changes
- Most serdes that required a number serdes now optionally accept a serdes. and their default is
Squish.f32(). - Serialization now optionally checks the type of the provided parameter. This is toggled by the
VALIDATIONENABLEDpresent at the top of the script. This setting should be kept false if you aren't debugging as it heavily impacts performance. - Type for many serdes such as
Squish.record()is evaluated using a type function to make the use ofSquish.T()obsolete. so you generally don't need to use that anymore.
Squish is heavily reliant on the new type solver, thus types for many functions - particularly Squish.table(), Squish.record(), ... - will not work with the old solver.
- Performance is faster for most if not all the serdes than with the base squash module.
- Exposes more functions that help with creating your own serdes.
SerDes Changes.
-
[ NEW ] number: Serdes accepting any number of any size.
-
[ NEW ] Nil: Serdes for.. nil.
-
[ NEW ] dedup: Serdes that deduplicates serialized values.
-
[ NEW ] Color3f16: Serdes for color3, but not restricted to [0-255] range.
-
[ NEW ] Instance: Serdes for Instances.
-
[ NEW ] types: Serdes for multiple types.
-
[ NEW ] any: Serdes for any type, except tables.
-
[ CHANGE ] boolean:
Only accepts one boolean parameter, original behavior has been moved to boolpack. -
[ CHANGE ] range:
Added 2 new parameters:SerDes: Defines which SerDes to use for serializing the numbers, overriding original.restricted: Defines whether the numbers should be clamped to the range of min - max when serializing and deserializing.
-
[ CHANGE ] table:
Added second parametervalueschema(lengthis now third) for the schema of the values in the table.
Ifvalueschemais not provided, will reusekeyschemafor the values. -
[ CHANGE ] vector:
All vector functions have been combined into a single one as the old api was confusing (eg.Squash.vector2andSquash.Vector2were not the same.)
By default,Squish.vector()will return a SerDes for the vector size currently used (4-wide) or (3-wide), You can change this by providing thesizeparameter.Squish.Vector2()still remains, however, as it is a datatype in roblox. -
[ CHANGE ] EnumItem:
Can be provided no enum, in which case it will accept any enumitem. -
[ CHANGE ] CFrame:
Can be providedfalsein which case it will only serialize the rotational component of cframes.Squish.rotation()now acts as a wrapper forSquish.CFrame(false). -
[ CHANGE ] RaycastResult:
Can serialize the basepart.
Benchmarks.
The following benchmarks show performance differences between Squash 5.0.0 and Squish.