|
| 30 Jun 2014 06:59 PM |
Need a CFrame, Vector3, Vector2, BrickColor or Color3 stored as a String for saving to Data Stores or converting to JSON?
Well, I have made a ModuleScript to do so!
All you need to do is require the ModuleScript and use the following functions:
toString(object, type)
Will convert the CFrame/Vector3/Color3/whatever into a string (You have to specify if it is a CFrame, Vector3, Color3 or whatever)
fromString(string)
Will convert the string back into its original state, automatically detecting the type for you!
Furthermore, CFrame values are stored as quaternions to reduce space, and all numbers are stored at up to 16 decimal places to conserve quality (Don't worry, it automatically chops off any trailing zeros!) with the exception of BrickColor and Color3 values, which are stored as integers for space reduction.
Link to model: http://www.roblox.com/Object-Conerter-item?id=164043356
Enjoy your strings!
-Notunknown99 |
|
|
| Report Abuse |
|
|
|
| 30 Jun 2014 07:50 PM |
| Next version will include conversion of (almost every) instance into a string, although Instance properties (Weld.Part0/InstanceValue.Value/etc) and the source of Scripts will be lost. Scripts will retain their LinkedSource, though. |
|
|
| Report Abuse |
|
|
|
| 30 Jun 2014 09:56 PM |
Now Version 2.0.0:
NEW FEATURES: Can now convert Strings, Numbers, Booleans, Rays, UDim2s and Instances to and from Strings. BUGFIXES: Fixed it generally not working. Sorry about that!
NOTE: It (currently) cannot handle Instance properties, and will leave those blank.
Next up: Increase efficiency of storing Instances (I will create an "Integer" field for properties that can only store integers) and allow for Instance properties (Provided the Instance in question is a Descendant of the main instance) |
|
|
| Report Abuse |
|
|
|
| 30 Jun 2014 10:16 PM |
Version 2.1.0
BUGFIXES: Made warnings correctly outputted (They are outputted in a lovely orange). |
|
|
| Report Abuse |
|
|
|
| 30 Jun 2014 10:50 PM |
Version 2.2.0
NEW FEATURES: Can now convert Integers which will not have any decimals. ("integer" instead of "number") Now removes redundant information when converting instances into strings. |
|
|
| Report Abuse |
|
|
| |
|