summaryrefslogtreecommitdiff
path: root/scripts/context/lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2010-10-20 22:40:11 +0300
committerMarius <mariausol@gmail.com>2010-10-20 22:40:11 +0300
commit575435e91f9abcf123aa96fd3790e0d61b719333 (patch)
treed59a1d839eb9a477cb5b2c4301218de0ba0ef815 /scripts/context/lua
parentb23c2188805ed9f7bdbdbe11eed957a32e90f5ce (diff)
downloadcontext-575435e91f9abcf123aa96fd3790e0d61b719333.tar.gz
beta 2010.10.20 21:33
Diffstat (limited to 'scripts/context/lua')
-rw-r--r--scripts/context/lua/mtxrun.lua19
1 files changed, 12 insertions, 7 deletions
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua
index b792e35af..00d4fe9c3 100644
--- a/scripts/context/lua/mtxrun.lua
+++ b/scripts/context/lua/mtxrun.lua
@@ -848,20 +848,25 @@ local function do_serialize(root,name,depth,level,indexed)
depth = depth .. " "
if indexed then
handle(format("%s{",depth))
- elseif name then
- if type(name) == "number" then -- or find(k,"^%d+$") then
+ else
+ local tn = type(name)
+ if tn == "number" then -- or find(k,"^%d+$") then
if hexify then
handle(format("%s[0x%04X]={",depth,name))
else
handle(format("%s[%s]={",depth,name))
end
- elseif noquotes and not reserved[name] and find(name,"^%a[%w%_]*$") then
- handle(format("%s%s={",depth,name))
+ elseif tn == "string" then
+ if noquotes and not reserved[name] and find(name,"^%a[%w%_]*$") then
+ handle(format("%s%s={",depth,name))
+ else
+ handle(format("%s[%q]={",depth,name))
+ end
+ elseif tn == "boolean" then
+ handle(format("%s[%s]={",depth,tostring(name)))
else
- handle(format("%s[%q]={",depth,name))
+ handle(format("%s{",depth))
end
- else
- handle(format("%s{",depth))
end
end
-- we could check for k (index) being number (cardinal)