Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function a(b)if type(b)~="string"then error("Invalid argument #1 expected string (got "..type(b)..")",2)end;local c=b:match("^%s*()")return c>#b and""or b:match(".*%S",c)end;function _G.lambda(d)local e=true;d=a(d)if d:sub(1,3):lower()=="do "then d=d:sub(3,#d)e=false end;d="local __args__={...};"..(e and"return "or"")..d:gsub("\$%d+",function(f)return"__args__["..f:sub(2,#f).."]"end)local g=getfenv(2)local h="[lambda]"if type(g)=="table"and type(g.__filename)=="string"then h=g.__filename end;local i,j=loadstring(d,h)if not i then error(j,-1)end;setfenv(i,g)return i end;return _G.lambda
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement