Wrote a serializer for a plugin I’m working on to be able to store datatypes like Vector3 or PhysicalProperties as a string in plugin:SetSetting()
.
Currently supported datatypes:
primitives (string, number, bool)
Axes,BrickColor,CFrame,Color3,ColorSequence,DateTime,
EnumItem,Faces,Instance,NumberRange,NumberSequence, -- (Instance saves the path and deserializes with best effort)
PhysicalProperties,Ray,Rect,UDim,UDim2,Vector2,Vector3
Currently unsupported datatypes: (These aren’t Properties so they weren’t MVP for my serializer)
CatalogSearchParams,ColorSequenceKeypoint,
DockWidgetPluginGuiInfo,NumberSequenceKeypoint,
PathWaypoint,Random,RaycastParams,RaycastResult,
RBXScriptConnection,RBXScriptSignal,Region3,
Region3int16,TweenInfo,Vector2int16,Vector3int16
Example:
Original Table:
▼ table: 0xd06348dd5d6ad810 = {
["some-big-guid"] = ▼ table: 0x260250c8df47ce50 = {
["Properties"] = ▼ table: 0x147af943d0b0f590 = {
["Adornee"] = Baseplate,
["Position"] = 1, 2, 3
}
},
["some-other-guid"] = ▼ table: 0x1ef98342561df2d0 = {
["Properties"] = ▼ table: 0x196db95924f6f310 = {
["CustomPhysicalProperties"] = *cannot read value as a string
}
}
}
Serialized String:
1,264|{! A s o m e - o t h e r - g u i d!# :!! A P r o p!- t i e s!4!6 C u s t!& P h y s i c a l!8!:!<!>!@ A!5!# _ _ s a n i!= z e!4!#!H!J!L!N!P!; r!=!?!# ,!# E l a!E!L!^ y W e i g h t!4 1!n A!p!r!= c!u!4 0 . 2 5# F r!L!= o n#( . 4 0#7#8 0 5 9 6 0 4 6 4 4 7 7 5 3 9 0 6#+#-#/ c#1 n!w!y!{!}# D e n!K t y!4 7 . 8 4 9#a#a#> 6 3#+ 6 8 3#; 3#D }#n# !%!' - b!y!/!1!3!U!6!h!R!l#y!c o#X i#2!A!W!Y![!^ i!`!b A V e#M o r 3!m!# Z!4 3# X#S!# Y!4 2 }# A d$2 n e!a#~ A!X!Z!]!_$H :!# I#W t![ c$H#- u l l N a!'$- W$2 k s p a$V . B!r e p!q t$H#n#n
Deserialized Table:
▼ table: 0xb0d910c5ae520550 = {
["some-big-guid"] = ▼ table: 0x657fc83585cb0010 = {
["Properties"] = ▼ table: 0xb6e7505880e60650 = {
["Adornee"] = Baseplate,
["Position"] = 1, 2, 3
}
},
["some-other-guid"] = ▼ table: 0x818c08d773a53c90 = {
["Properties"] = ▼ table: 0xbde72036b70807d0 = {
["CustomPhysicalProperties"] = *cannot read value as a string
}
}
}
When I get this thing feature complete, I plan to open source it.