Changeset

9568:69f589c888e7

util.serialization: Disable use of unquoted table keys by default For safety against future new keywords
author Kim Alvefur <zash@zash.se>
date Sat, 27 Oct 2018 12:48:48 +0200
parents 9567:dbfa286cfa88
children 9569:0bc399953c27
files util/serialization.lua
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/util/serialization.lua	Sat Oct 27 12:43:03 2018 +0200
+++ b/util/serialization.lua	Sat Oct 27 12:48:48 2018 +0200
@@ -85,6 +85,7 @@
 		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 @@
 		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 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;