Diff

util/serialization.lua @ 9341:009dad867e52

util.serialization: Stricter type check
author Kim Alvefur <zash@zash.se>
date Sun, 23 Sep 2018 16:11:13 +0200
parent 9060:69bc3144c2b7
child 9480:006a71a83e6a
line wrap: on
line diff
--- a/util/serialization.lua	Sat Sep 22 16:03:50 2018 +0200
+++ b/util/serialization.lua	Sun Sep 23 16:11:13 2018 +0200
@@ -142,7 +142,7 @@
 		if freeze then
 			-- opportunity to do pre-serialization
 			local mt = getmetatable(t);
-			local fr = (freeze ~= true and freeze[mt]);
+			local fr = (type(freeze) == "table" and freeze[mt]);
 			local mf = mt and mt.__freeze;
 			local tag;
 			if type(fr) == "string" then