@@ -8,7 +8,6 @@ local UI = GSE.UI
88local L = GSE .L
99
1010local exportframe = UI :Create (" Frame" )
11- local uncompressedVersion = nil
1211exportframe :SetSize (760 , 560 )
1312exportframe :Hide ()
1413exportframe .classid = 0
@@ -403,11 +402,26 @@ GSE.GUIAdvancedExport = function(exportframe, objectname, exportCategory)
403402 " OnValueChanged" ,
404403 function (obj , event , key , checked )
405404 if checked then
406- uncompressedVersion .objectType = " VARIABLE"
407- uncompressedVersion .name = key
408- exportTable [" Variables" ][key ] = GSE .EncodeMessage (uncompressedVersion )
405+ if exportTable [" Variables" ][key ] then return end
406+ local stored = not GSE .isEmpty (GSEVariables ) and GSEVariables [key ] or nil
407+ local payload
408+ if type (stored ) == " string" and stored :sub (1 , 7 ) == " !GSE3!+" then
409+ -- Protected variable: ship the packed string untouched so the
410+ -- import side stores it still encrypted.
411+ payload = stored
412+ else
413+ local ok , decoded = GSE .DecodeMessage (stored or " " )
414+ if not ok or type (decoded ) ~= " table" then
415+ GSE .Print (string.format (L [" Unable to interpret variable '%s'." ], key ), " Error" )
416+ return
417+ end
418+ decoded .name = key
419+ payload = decoded
420+ end
421+ exportTable [" Variables" ][key ] = payload
409422 exportTable .ElementCount = exportTable .ElementCount + 1
410423 else
424+ if not exportTable [" Variables" ][key ] then return end
411425 exportTable [" Variables" ][key ] = nil
412426 exportTable .ElementCount = exportTable .ElementCount - 1
413427 end
@@ -446,11 +460,18 @@ GSE.GUIAdvancedExport = function(exportframe, objectname, exportCategory)
446460 for vname in pairs (allDeps ) do
447461 if not GSE .isEmpty (GSEVariables ) and not GSE .isEmpty (GSEVariables [vname ]) then
448462 if not exportTable [" Variables" ][vname ] then
449- local ok , decoded = GSE . DecodeMessage ( GSEVariables [vname ])
450- if ok and decoded then
451- exportTable [" Variables" ][vname ] = decoded
463+ local storedVar = GSEVariables [vname ]
464+ if type ( storedVar ) == " string " and storedVar : sub ( 1 , 7 ) == " !GSE3!+ " then
465+ exportTable [" Variables" ][vname ] = storedVar
452466 exportTable .ElementCount = exportTable .ElementCount + 1
453467 table.insert (included , vname )
468+ else
469+ local ok , decoded = GSE .DecodeMessage (storedVar )
470+ if ok and type (decoded ) == " table" then
471+ exportTable [" Variables" ][vname ] = decoded
472+ exportTable .ElementCount = exportTable .ElementCount + 1
473+ table.insert (included , vname )
474+ end
454475 end
455476 end
456477 else
0 commit comments