- # Dummy for saving all commands to reconstruct current world state.
- # Misses same optimizations as record() from the original record().
- # How to handle strings that contain ' or "?
+ """Save all commands needed to reconstruct current world state."""
+ # TODO: Misses same optimizations as record() from the original record().
+
+ def quote(string):
+ string = string.replace("\u005C", '\u005C\u005C')
+ return '"' + string.replace('"', '\u005C"') + '"'