Fix serialization function to guard internal values

This commit is contained in:
Pablo Ariel Mayobre 2020-03-14 19:09:23 -03:00
parent 079c1d0e18
commit d8621e4070
No known key found for this signature in database
GPG key ID: 5ACD9E6858BEB0A9

View file

@ -47,11 +47,18 @@ end
function Component:__populate() -- luacheck: ignore function Component:__populate() -- luacheck: ignore
end end
function Component:serialize() -- luacheck: ignore function Component:serialize()
return Utils.shallowCopy(self, {}) local data = Utils.shallowCopy(self, {})
--This values shouldn't be copied over
data.__componentClass = nil
data.__isComponent = nil
data.__isComponentClass = nil
return data
end end
function Component:deserialize(data) -- luacheck: ignore function Component:deserialize(data)
Utils.shallowCopy(data, self) Utils.shallowCopy(data, self)
end end