Software /
code /
prosody
Comparison
util/datamanager.lua @ 88:023320150c65
Minor fix
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Thu, 09 Oct 2008 03:21:16 +0500 |
parent | 87:059ef1c30844 |
child | 117:8e5c5e6a3240 |
comparison
equal
deleted
inserted
replaced
87:059ef1c30844 | 88:023320150c65 |
---|---|
3 local pairs = pairs; | 3 local pairs = pairs; |
4 local char = string.char; | 4 local char = string.char; |
5 local loadfile, setfenv, pcall = loadfile, setfenv, pcall; | 5 local loadfile, setfenv, pcall = loadfile, setfenv, pcall; |
6 local log = log; | 6 local log = log; |
7 local io_open = io.open; | 7 local io_open = io.open; |
8 local tostring = tostring; | |
8 | 9 |
9 module "datamanager" | 10 module "datamanager" |
10 | 11 |
11 | 12 |
12 ---- utils ----- | 13 ---- utils ----- |
28 | 29 |
29 local function basicSerialize (o) | 30 local function basicSerialize (o) |
30 if type(o) == "number" or type(o) == "boolean" then | 31 if type(o) == "number" or type(o) == "boolean" then |
31 return tostring(o) | 32 return tostring(o) |
32 else -- assume it is a string | 33 else -- assume it is a string |
33 return string.format("%q", tostring(o)) | 34 return format("%q", tostring(o)) |
34 end | 35 end |
35 end | 36 end |
36 | 37 |
37 | 38 |
38 local function simplesave (f, o) | 39 local function simplesave (f, o) |