From 28031d133df8b9f7f25edcc9fde46147400127d1 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 27 Oct 2018 12:48:48 +0200 Subject: util.serialization: Disable use of unquoted table keys by default For safety against future new keywords --- util/serialization.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'util') diff --git a/util/serialization.lua b/util/serialization.lua index a8b64c04..52e89136 100644 --- a/util/serialization.lua +++ b/util/serialization.lua @@ -85,6 +85,7 @@ local function new(opt) opt.freeze = true; opt.fatal = false; opt.fallback = default_fallback; + opt.unquoted = true; end if opt.preset == "oneline" then opt.indentwith = opt.indentwith or ""; @@ -96,6 +97,7 @@ local function new(opt) opt.itemstart = opt.itemstart or ""; opt.itemlast = opt.itemlast or ""; opt.equals = opt.equals or "="; + opt.unquoted = true; end local fallback = opt.fallback or opt.fatal == false and default_fallback or fatal_error; @@ -116,7 +118,7 @@ local function new(opt) local kstart = opt.kstart or "["; local kend = opt.kend or "]"; local equals = opt.equals or " = "; - local unquoted = opt.unquoted == nil and "^[%a_][%w_]*$" or opt.unquoted; + local unquoted = opt.unquoted == true and "^[%a_][%w_]*$" or opt.unquoted; local hex = opt.hex; local freeze = opt.freeze; local maxdepth = opt.maxdepth or 127; -- cgit v1.2.3