mirror of
https://github.com/bjc/prosody.git
synced 2025-04-04 13:47:41 +03:00
util.template: Use separate variables for source and compiled function [luacheck]
This commit is contained in:
parent
1e4a5f2baa
commit
c414d27829
1 changed files with 4 additions and 4 deletions
|
@ -67,12 +67,12 @@ end
|
||||||
local function create_cloner(stanza, chunkname)
|
local function create_cloner(stanza, chunkname)
|
||||||
local lookup = {};
|
local lookup = {};
|
||||||
local name = create_clone_string(stanza, 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
|
for i=1,#lookup do
|
||||||
f = f.."local _"..i.."="..lookup[i]..";";
|
src = src.."local _"..i.."="..lookup[i]..";";
|
||||||
end
|
end
|
||||||
f = f.."return "..name..";end";
|
src = src.."return "..name..";end";
|
||||||
local f,err = loadstring(f, chunkname);
|
local f,err = loadstring(src, chunkname);
|
||||||
if not f then error(err); end
|
if not f then error(err); end
|
||||||
return f(setmetatable, stanza_mt);
|
return f(setmetatable, stanza_mt);
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue