Software / code / prosody
Comparison
util/serialization.lua @ 1128:b2e548344d61 0.4.1
util.serialization: Write nil for non-serializable data types, and bump the log level to 'error'
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 05 May 2009 18:07:13 +0100 |
| parent | 1107:ebda1845ebc1 |
| child | 1135:355f9487ab38 |
comparison
equal
deleted
inserted
replaced
| 1127:3911e81aff19 | 1128:b2e548344d61 |
|---|---|
| 50 func(t, indent(ind-1)); | 50 func(t, indent(ind-1)); |
| 51 func(t, "}"); | 51 func(t, "}"); |
| 52 elseif type(o) == "boolean" then | 52 elseif type(o) == "boolean" then |
| 53 func(t, (o and "true" or "false")); | 53 func(t, (o and "true" or "false")); |
| 54 else | 54 else |
| 55 log("warn", "cannot serialize a %s: %s", type(o), debug_traceback()) | 55 log("error", "cannot serialize a %s: %s", type(o), debug_traceback()) |
| 56 func(t, "nil,\n"); | |
| 56 end | 57 end |
| 57 end | 58 end |
| 58 | 59 |
| 59 function append(t, o) | 60 function append(t, o) |
| 60 _simplesave(o, 1, t, t.write or t_insert); | 61 _simplesave(o, 1, t, t.write or t_insert); |