# HG changeset patch # User Kim Alvefur # Date 1540637697 -7200 # Node ID 0bc399953c2716b990e4da8b4e2455167ce7f06b # Parent 69f589c888e7ff7bbf0f4c7b426b18ebdcd94a37 util.serialization: Rename non-fatal fallback handler for clarity diff -r 69f589c888e7 -r 0bc399953c27 util/serialization.lua --- a/util/serialization.lua Sat Oct 27 12:48:48 2018 +0200 +++ b/util/serialization.lua Sat Oct 27 12:54:57 2018 +0200 @@ -38,7 +38,7 @@ error("Can't serialize "..type(obj) .. (why and ": ".. why or "")); end -local function default_fallback(x, why) +local function nonfatal_fallback(x, why) return s_format("nil --[[%s: %s]]", type(x), why or "fail"); end @@ -84,7 +84,7 @@ opt.preset = "oneline"; opt.freeze = true; opt.fatal = false; - opt.fallback = default_fallback; + opt.fallback = nonfatal_fallback; opt.unquoted = true; end if opt.preset == "oneline" then @@ -100,7 +100,7 @@ opt.unquoted = true; end - local fallback = opt.fallback or opt.fatal == false and default_fallback or fatal_error; + local fallback = opt.fallback or opt.fatal == false and nonfatal_fallback or fatal_error; local function ser(v) return (types[type(v)] or fallback)(v);