Software / code / prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
| 9340:368b092bf4bf | 9341:009dad867e52 |
|---|---|
| 140 | 140 |
| 141 o[t] = true; | 141 o[t] = true; |
| 142 if freeze then | 142 if freeze then |
| 143 -- opportunity to do pre-serialization | 143 -- opportunity to do pre-serialization |
| 144 local mt = getmetatable(t); | 144 local mt = getmetatable(t); |
| 145 local fr = (freeze ~= true and freeze[mt]); | 145 local fr = (type(freeze) == "table" and freeze[mt]); |
| 146 local mf = mt and mt.__freeze; | 146 local mf = mt and mt.__freeze; |
| 147 local tag; | 147 local tag; |
| 148 if type(fr) == "string" then | 148 if type(fr) == "string" then |
| 149 tag = fr; | 149 tag = fr; |
| 150 fr = mf; | 150 fr = mf; |