aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-06-12 15:55:23 (GMT)
committerPavel Labath <pavelo@centrum.sk>2011-06-15 23:12:52 (GMT)
commit2ab8a36685b20d830be53454a2a2375a370ae8aa (patch)
tree83872656d58eb2fdd6a2ca7fbf8cdaf8ca646042 /src/FbTk
parentfe4b924bcb7d059e5ca059f88ba863a74c0d8760 (diff)
downloadfluxbox_pavel-2ab8a36685b20d830be53454a2a2375a370ae8aa.zip
fluxbox_pavel-2ab8a36685b20d830be53454a2a2375a370ae8aa.tar.bz2
Lua resources: Add support for saving of boolean values
Diffstat (limited to 'src/FbTk')
-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