From 487f96c2f1700d17e5ed7623183a26a5345a3537 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 26 Sep 2020 23:17:53 +0200 Subject: util.serialization: Let freeze metamethod return a literal string Enables custom serialization, such as creating a datatype that serializes into a variable reference. --- util/serialization.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'util') diff --git a/util/serialization.lua b/util/serialization.lua index d70e92ba..d310a3e8 100644 --- a/util/serialization.lua +++ b/util/serialization.lua @@ -150,6 +150,10 @@ local function new(opt) if type(fr) == "function" then t = fr(t); + if type(t) == "string" then + o[l], l = t, l + 1; + return l; + end if type(tag) == "string" then o[l], l = tag, l + 1; end -- cgit v1.2.3