aboutsummaryrefslogtreecommitdiffstats
path: root/util/serialization.lua
diff options
context:
space:
mode:
Diffstat (limited to 'util/serialization.lua')
-rw-r--r--util/serialization.lua16
1 files changed, 11 insertions, 5 deletions
diff --git a/util/serialization.lua b/util/serialization.lua
index d310a3e8..ee4751e2 100644
--- a/util/serialization.lua
+++ b/util/serialization.lua
@@ -16,15 +16,17 @@ local s_char = string.char;
local s_match = string.match;
local t_concat = table.concat;
-local to_hex = require "util.hex".to;
+local to_hex = require "prosody.util.hex".to;
local pcall = pcall;
-local envload = require"util.envload".envload;
+local envload = require"prosody.util.envload".envload;
+
+if not math.type then
+ require "prosody.util.mathcompat"
+end
local pos_inf, neg_inf = math.huge, -math.huge;
-local m_type = math.type or function (n)
- return n % 1 == 0 and n <= 9007199254740992 and n >= -9007199254740992 and "integer" or "float";
-end;
+local m_type = math.type;
local function rawpairs(t)
return next, t, nil;
@@ -94,6 +96,10 @@ local function new(opt)
opt.itemlast = opt.itemlast or "";
opt.equals = opt.equals or "=";
opt.unquoted = true;
+ elseif opt.preset == "pretty" then
+ opt.fatal = false;
+ opt.freeze = true;
+ opt.unquoted = true;
end
local fallback = opt.fallback or opt.fatal == false and nonfatal_fallback or fatal_error;