Replaced table concat with str concat in lume.lambda()

This offers an improvement in performance for the function on Lua5.1,
5.2 and JIT 2.0.2
This commit is contained in:
rxi 2014-03-08 22:15:08 +00:00
parent f8cbfc0bb0
commit fbb5cbac1a

View File

@ -215,8 +215,8 @@ end
function lume.lambda(str)
local args, body = str:match([[^([%w,_ ]-)%->(.-)$]])
assert(args and body, "bad string lambda")
local t = { "return function(", args, ")\nreturn ", body, "\nend" }
return lume.dostring(table.concat(t))
local s = "return function(" .. args .. ")\nreturn " .. body .. "\nend"
return lume.dostring(s)
end