Diff

plugins/storage/sqlbasic.lib.lua @ 5021:85b2689dbcfe

Eliminate direct setfenv usage
author Florian Zeitz <florob@babelmonkeys.de>
date Fri, 08 Jun 2012 05:04:38 +0200
parent 2678:c5882e2e12b5
line wrap: on
line diff
--- a/plugins/storage/sqlbasic.lib.lua	Thu Jun 07 23:27:26 2012 +0200
+++ b/plugins/storage/sqlbasic.lib.lua	Fri Jun 08 05:04:38 2012 +0200
@@ -3,12 +3,12 @@
 -- This driver stores data as simple key-values
 
 local ser = require "util.serialization".serialize;
+local envload = require "util.envload".envload;
 local deser = function(data)
 	module:log("debug", "deser: %s", tostring(data));
 	if not data then return nil; end
-	local f = loadstring("return "..data);
+	local f = envload("return "..data, nil, {});
 	if not f then return nil; end
-	setfenv(f, {});
 	local s, d = pcall(f);
 	if not s then return nil; end
 	return d;