mirror of
https://github.com/TangentFoxy/lume.git
synced 2025-07-28 11:02:20 +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:
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
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user