aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-06-12 15:55:23 (GMT)
committerPavel Labath <pavelo@centrum.sk>2011-11-01 09:55:30 (GMT)
commitcbdc84bd064a1769410a2d5236e75ac323e79b1e (patch)
tree957278ca63c3a50bdb0555d9cb86315c6b5c84ce /src
parent7a46f95d0ce4e249812fb5c2685308cd7283b37d (diff)
downloadfluxbox_paul-cbdc84bd064a1769410a2d5236e75ac323e79b1e.zip
fluxbox_paul-cbdc84bd064a1769410a2d5236e75ac323e79b1e.tar.bz2
Lua resources: Add support for saving of boolean values
Diffstat (limited to 'src')
-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