mirror of
https://github.com/TangentFoxy/lume.git
synced 2024-11-19 07:04:24 +00:00
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:
parent
f8cbfc0bb0
commit
fbb5cbac1a
4
lume.lua
4
lume.lua
@ -215,8 +215,8 @@ end
|
|||||||
function lume.lambda(str)
|
function lume.lambda(str)
|
||||||
local args, body = str:match([[^([%w,_ ]-)%->(.-)$]])
|
local args, body = str:match([[^([%w,_ ]-)%->(.-)$]])
|
||||||
assert(args and body, "bad string lambda")
|
assert(args and body, "bad string lambda")
|
||||||
local t = { "return function(", args, ")\nreturn ", body, "\nend" }
|
local s = "return function(" .. args .. ")\nreturn " .. body .. "\nend"
|
||||||
return lume.dostring(table.concat(t))
|
return lume.dostring(s)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user