aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/FbTk/LResourceHelper.lua21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/FbTk/LResourceHelper.lua b/src/FbTk/LResourceHelper.lua
index dd4ac2e..b16e756 100644
--- a/src/FbTk/LResourceHelper.lua
+++ b/src/FbTk/LResourceHelper.lua
@@ -102,11 +102,7 @@ local function register_resource(root, name, object)
102end; 102end;
103 103
104local function dump_(key, value, fd) 104local function dump_(key, value, fd)
105 if type(value) == 'string' then 105 if type(value) == 'table' then
106 fd:write(key, ' = ', string.format('%q', value), '\n');
107 elseif type(value) == 'number' then
108 fd:write(key, ' = ', string.format('%g', value), '\n');
109 elseif type(value) == 'table' then
110 fd:write(key, ' = {}\n'); 106 fd:write(key, ' = {}\n');
111 for k, v in pairs(value) do 107 for k, v in pairs(value) do
112 k = append_name(key, k); 108 k = append_name(key, k);
@@ -124,7 +120,20 @@ local function dump_(key, value, fd)
124 end; 120 end;
125 fd:write('\n'); 121 fd:write('\n');
126 else 122 else
127 error('Unsupported value type: ' .. type(val)); 123 if type(value) == 'string' then
124 value = string.format('%q', value);
125 elseif type(value) == 'number' then
126 value = string.format('%g', value);
127 elseif type(value) == 'boolean' then
128 if value then
129 value = "true";
130 else
131 value = "false";
132 end;
133 else
134 error('Unsupported value type for ' .. key .. ': ' .. type(value));
135 end;
136 fd:write(key, ' = ', value, '\n');
128 end; 137 end;
129end; 138end;
130 139