Skip to content

Commit

Permalink
Add default ser methods for Vector3 and Color3
Browse files Browse the repository at this point in the history
  • Loading branch information
jisham318 committed Nov 25, 2023
1 parent e816123 commit 1ad471c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions modules/ser/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,22 @@ Ser.Classes = {
end,
Deserialize = Option.Deserialize,
},
Vector3 = {
Serialize = function(v3 : Vector3)
return { ClassName = "Vector3", Value = {X = v3.X, Y = v3.Y, Z = v3.Z} }
end,
Deserialize = function(tbl : {ClassName : string, Value : {X : number, Y : number, Z : number}})
return Vector3.new(tbl.Value.X, tbl.Value.Y, tbl.Value.Z)
end
},
Color3 = {
Serialize = function(c3 : Color3)
return { ClassName = "Color3", Value = c3:ToHex() }
end,
Deserialize = function(tbl : {ClassName : string, Value : string})
return Color3.fromHex(tbl.Value)
end
}
}

--[=[
Expand Down

0 comments on commit 1ad471c

Please sign in to comment.