Skip to content

commitblue/blueserializer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

blueserializer

A serializer written so you dont have to make one yourself.
 

Why.

Roblox primitive types are a thing, We use it regularly and alot, even if you didn't know. and the issue with it is that..

  1. You cant save it to datastores
  2. You cant transfer them through remotes Writing your serializers is just pain. So I wrote this package just for the purpose of Serializing roblox's primitive types to make them supported for these.

Supported primitive types (so far)

Supported primitive types
CFrame
Vector3
Color3
EnumItem
BrickColor
TweenInfo
Vector2
Vector2int16
Vector3int16
UDim
UDim2
Region3
Region3int16
PhysicalProperties
Rect
NumberRange
Ray
DockWidgetPluginGuiInfo
PathwayPoint
Font
Axes

Also special thanks to contributors for adding too much serializable types to the module!

(note that ill probably not update this list frequently but to get the latest list, read serializerList.lua inside the module folder)

Small examples

local blueSerializer = require(path.to.blueserializer)
local serialized = blueSerializer.serialize(Vector3.new(1, 5, 88))
print(serialized) -- >> {"V", 1, 5, 88}
print(blueSerializer.deserialize(serialized)) -- >> Vector3.new(1, 5, 88) or in the output 1, 5, 88
-- blueSerialize.deSerialize exists as an alias of blueSerializer.deserialize
local blueSerializer = require(path.to.blueserializer)
local dataStoreService = game:GetService("DataStoreService")
local dataStore = dataStoreService:GetDataStore("mypart")
local myPart = workspace.myPart
-- i want to save the part's position and the part's color3 in workspace
dataStore:SetAsync("mypart", {
    Position = blueSerializer.serialize(myPart.Position),
    Color3 = blueSerializer.serialize(myPart.Color3)
})

-- the loading
local dat = dataStore:GetAsync("mypart")
myPart.Position = blueSerializer.deserialize(dat.Position)
myPart.Color3 = blueSerializer.deserialize(dat.Color3)

-- note this is psuedo example code and is only supposed to represent the basic usage
-- of blue serializer

Note this module is not the most optimized way to serialize.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages