From 1e4a5f2baa17be8ea10bbd9973c3d87dd23c3223 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 25 Feb 2016 22:31:13 +0100 Subject: util.template: Silence luacheck warnings about unused loop vars --- util/template.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/template.lua') diff --git a/util/template.lua b/util/template.lua index a26dd7ca..f72c4ede 100644 --- a/util/template.lua +++ b/util/template.lua @@ -1,4 +1,4 @@ - +-- luacheck: ignore 213/i local stanza_mt = require "util.stanza".stanza_mt; local setmetatable = setmetatable; local pairs = pairs; -- cgit v1.2.3 From c414d27829b3dec37e804359121c0dc82c443d9d Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 25 Feb 2016 22:32:13 +0100 Subject: util.template: Use separate variables for source and compiled function [luacheck] --- util/template.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'util/template.lua') diff --git a/util/template.lua b/util/template.lua index f72c4ede..04ebb93d 100644 --- a/util/template.lua +++ b/util/template.lua @@ -67,12 +67,12 @@ end 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 -- cgit v1.2.3