Changeset

3980:6b2fac6602b3

mod_storage_sql: Use util.json instead of util.serialization.
author Waqas Hussain <waqas20@gmail.com>
date Mon, 27 Dec 2010 19:43:57 +0500
parents 3979:bf223e6c2b4c
children 3981:2b0b8fe68df2
files plugins/mod_storage_sql.lua
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_storage_sql.lua	Mon Dec 27 19:37:04 2010 +0500
+++ b/plugins/mod_storage_sql.lua	Mon Dec 27 19:43:57 2010 +0500
@@ -25,7 +25,7 @@
 local pairs = pairs;
 local next = next;
 local setmetatable = setmetatable;
-local json = { stringify = function(s) return require"util.serialization".serialize(s) end, parse = require"util.serialization".deserialize };
+local json = require "util.json";
 
 local connection = ...;
 local host,user,store = module.host;
@@ -59,7 +59,7 @@
 			module:log("debug", "Initialized new SQLite3 database");
 		end
 		assert(connection:commit());
-		--print("===", json.stringify())
+		--print("===", json.encode())
 	end
 end
 
@@ -68,7 +68,7 @@
 	if t == "string" or t == "boolean" or t == "number" then
 		return t, tostring(value);
 	elseif t == "table" then
-		local value,err = json.stringify(value);
+		local value,err = json.encode(value);
 		if value then return "json", value; end
 		return nil, err;
 	end
@@ -81,7 +81,7 @@
 		elseif value == "false" then return false; end
 	elseif t == "number" then return tonumber(value);
 	elseif t == "json" then
-		return json.parse(value);
+		return json.decode(value);
 	end
 end