garrysmod
garrysmod copied to clipboard
Add type serialization for Vector, Angle, Matrix, and Color
Remake of https://github.com/Facepunch/garrysmod/pull/920 with more flexibility and extendibility to custom types.
Adds:
-
string Vector:Serialize(string seperator)
(C++ implemented: https://gist.github.com/Kefta/e34782f4622a6bc63262b42d9dee451d ) -
string Angle:Serialize(string separator)
-
string Matrix:Serialize(string separator)
-
string Color:Serialize(string separator)
(Lua implemented)
This could also be implemented for entities by making Serialize return its ent index in string form. Would be one tostring
operation more efficient in some situations and less code for custom network serializers in Lua.
Also fixes incorrect usage of tostring
across the repo.
Don't have a computer that can run GMod to test, won't have one for the foreseeable future. Leaving this as a draft until it's verified.