Comparison

util/stanza.lua @ 9489:09b873ac7eb8

util.stanza: Set preserialize as freeze metamethod
author Kim Alvefur <zash@zash.se>
date Fri, 12 Oct 2018 00:52:18 +0200
parent 9307:feaef6215bb8
child 9630:bff66c3faceb
comparison
equal deleted inserted replaced
9488:a96a2fbcc6c0 9489:09b873ac7eb8
357 end 357 end
358 end 358 end
359 return s; 359 return s;
360 end 360 end
361 361
362 stanza_mt.__freeze = preserialize;
363
362 local function deserialize(stanza) 364 local function deserialize(stanza)
363 -- Set metatable 365 -- Set metatable
364 if stanza then 366 if stanza then
365 local attr = stanza.attr; 367 local attr = stanza.attr;
366 for i=1,#attr do attr[i] = nil; end 368 for i=1,#attr do attr[i] = nil; end