aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-09-26 23:17:53 +0200
committerKim Alvefur <zash@zash.se>2020-09-26 23:17:53 +0200
commitb93e90ebb3df8770e783318443baa3bafd9652d2 (patch)
treeb0a8aebc274f33088b57289dcd318f2c841bfe28 /util
parent534435a9d00e7389067ec6654a9afc3dc5c187ed (diff)
downloadprosody-b93e90ebb3df8770e783318443baa3bafd9652d2.tar.gz
prosody-b93e90ebb3df8770e783318443baa3bafd9652d2.zip
util.serialization: Let freeze metamethod return a literal string
Enables custom serialization, such as creating a datatype that serializes into a variable reference.
Diffstat (limited to 'util')
-rw-r--r--util/serialization.lua4
1 files changed, 4 insertions, 0 deletions
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