# HG changeset patch # User Kim Alvefur # Date 1601155073 -7200 # Node ID ec14d4fce855afb21cd4dbb91c46e6c9800646e3 # Parent bd13aa89262d141c47ecc3e4bf1bb6d5fb6d040f util.serialization: Let freeze metamethod return a literal string Enables custom serialization, such as creating a datatype that serializes into a variable reference. diff -r bd13aa89262d -r ec14d4fce855 util/serialization.lua --- a/util/serialization.lua Sat Sep 26 18:15:49 2020 +0200 +++ b/util/serialization.lua Sat Sep 26 23:17:53 2020 +0200 @@ -150,6 +150,10 @@ 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