Re: Help needed with .exe file issues.
Posted: Wed Mar 08, 2023 12:15 pm
If that's a requirement, then yes. But you can use this also to save everything that you are able to input to Ruby. Marshalling is more than just saving some numbers, though. It makes binaries of every object fed to it, so that it can be restored exactly as it was. For that it scans through all references to objects, to "paint the whole picture". For example, if you have an array filled with arrays of arrays, all of them will be saved to the binary string. Imagine it like a DAW snapshot - it will load all plugins, set them all to the last state, load the mixer settings, and so on.Spogg wrote:Ooh that’s interesting!tulamide wrote:When you use loadState and saveState in Ruby, it makes use of the Marshal module. You can use it as well. It generates a binary string, which you can simply save with the File class/IO class and later load in.
Usage:Code: Select all
result = Marshal.dump([myArray, myVar, "some string", in_short_any_object]) some_array, some_var, some_string, some_obj = Marshal.load(result)
So if I understand correctly, Tim could stay completely in the Ruby world…?
But if understood, it's a very useful instrument of restoring the state of objects and therefore saving data.