Description:
HTTP-Header manipulator and form variable preprocessor
-FileId:
-$Id$
-
License:
Copyright 2008 Steven Barth <steven@midlink.org>
write(" }")
end
elseif type(x) == "number" or type(x) == "boolean" then
- write(tostring(x))
- elseif type(x) == "string" then
- write("%q" % tostring(x))
+ if (x ~= x) then
+ -- NaN is the only value that doesn't equal to itself.
+ write("Number.NaN")
+ else
+ write(tostring(x))
+ end
+ else
+ write('"%s"' % tostring(x):gsub('["%z\1-\31]', function(c)
+ return '\\u%04x' % c:byte(1)
+ end))
end
end