Changeset

7197:ff514c1b1c27

util.template: Use separate variables for source and compiled function [luacheck]
author Kim Alvefur <zash@zash.se>
date Thu, 25 Feb 2016 22:32:13 +0100
parents 7196:94ec474debf5
children 7198:48d167f652ad
files util/template.lua
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/util/template.lua	Thu Feb 25 22:31:13 2016 +0100
+++ b/util/template.lua	Thu Feb 25 22:32:13 2016 +0100
@@ -67,12 +67,12 @@
 local function create_cloner(stanza, chunkname)
 	local lookup = {};
 	local name = create_clone_string(stanza, lookup, "");
-	local f = "local setmetatable,stanza_mt=...;return function(data)";
+	local src = "local setmetatable,stanza_mt=...;return function(data)";
 	for i=1,#lookup do
-		f = f.."local _"..i.."="..lookup[i]..";";
+		src = src.."local _"..i.."="..lookup[i]..";";
 	end
-	f = f.."return "..name..";end";
-	local f,err = loadstring(f, chunkname);
+	src = src.."return "..name..";end";
+	local f,err = loadstring(src, chunkname);
 	if not f then error(err); end
 	return f(setmetatable, stanza_mt);
 end