@@ -66,7 +66,7 @@ function SaveLoadHandler:SerializeTable(val, name, skipnewlines, depth)
66
66
if type (name ) == " number" then
67
67
tmp = tmp .. " [" .. name .. " ]" .. " = "
68
68
else
69
- tmp = tmp .. name .. " = "
69
+ tmp = tmp .. " [' " .. name .. " '] " .. " = "
70
70
end
71
71
end
72
72
@@ -92,6 +92,8 @@ function SaveLoadHandler:SerializeTable(val, name, skipnewlines, depth)
92
92
print (" ERROR: SaveLoadHandler tried to save a function. This cannot currently be done and the table will not be as expected when loaded." );
93
93
elseif val .Magnitude then -- ghetto vector check
94
94
tmp = tmp .. string.format (" %q" , " Vector(" .. val .X .. " ," .. val .Y .. " )" )
95
+ elseif val .Area then -- ghetto box check
96
+ tmp = tmp .. string.format (" %q" , " Box(" .. val .Corner .X .. " ," .. val .Corner .Y .. " ," .. val .Corner .X + val .Width .. " ," .. val .Corner .Y + val .Height .. " )" )
95
97
elseif val .PresetName and IsMOSRotating (val ) then -- IsMOSRotating freaks out if we give it something that isn't a preset at all... ghetto here too
96
98
val :SetNumberValue (" saveLoadHandlerUniqueID" , val .UniqueID );
97
99
tmp = tmp .. string.format (" %q" , " SAVELOADHANDLERUNIQUEID_" .. tostring (val .UniqueID ))
@@ -243,6 +245,18 @@ function SaveLoadHandler:ParseTableForVectors(tab)
243
245
244
246
end
245
247
248
+ function SaveLoadHandler :ParseTableForBoxes (tab )
249
+ for k , v in pairs (tab ) do
250
+ if type (v ) == " string" and string.find (v , " Box%(" ) then
251
+ local vector = loadstring (" return " .. v )();
252
+ tab [k ] = vector ;
253
+ elseif type (v ) == " table" then
254
+ self :ParseTableForBoxes (v );
255
+ end
256
+ end
257
+
258
+ end
259
+
246
260
function SaveLoadHandler :ParseTableForAreas (tab )
247
261
for k , v in pairs (tab ) do
248
262
if type (v ) == " string" and string.find (v , " SAVELOADHANDLERAREA_" ) then
@@ -289,6 +303,10 @@ function SaveLoadHandler:DeserializeTable(serializedTable, name)
289
303
print (" INFO: SaveLoadHandler is parsing this table for Vectors: " .. name );
290
304
end
291
305
self :ParseTableForVectors (tab );
306
+ if name and SaveLoadHandler .verboseLogging then
307
+ print (" INFO: SaveLoadHandler is parsing this table for Boxes: " .. name );
308
+ end
309
+ self :ParseTableForBoxes (tab );
292
310
if name and SaveLoadHandler .verboseLogging then
293
311
print (" INFO: SaveLoadHandler is parsing this table for Areas: " .. name );
294
312
end
0 commit comments