Script Object Serialization
I'm currently looking into ways to synchronize script objects over a network.
My current method for application side object is to serialize them, send, then unpack on the client and using a UID, update the corresponding client side object from with the deserialized values.
I overload the stream insertion and extraction operators to do the serializing at the moment.
What I'm wondering is how I might go about a similar method for Script Objects. My first thought is for each Script class to have a serialize/deserialize method, register a custom stream class and have methods it can use like: stream.putInt() / stream.getInt()
This is fine and all, but what sort of application side introspection can the script engine provide about Script side classes and objects? A more automatic serialization handled on the application side would be nicer.
asIScriptObject has member functions that can be used to inspect the state of a script object. GetPropertyCount() will tell you how many members the object has, GetPropertyTypeId() and GetPropertyName() will tell you about the type and name of the properties and you can use GetPropertyPointer() to inspect the individual values.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement