Advertisement
NonSequitur

Untitled

Jan 26th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.23 KB | None | 0 0
  1. local function chain(f, nf)
  2.     local nf = nf or #f
  3.     local function pass(i, ...)
  4.         if i == nf then
  5.             return f[nf](...)
  6.         else
  7.             return pass(i + 1, f[i](...))
  8.         end
  9.     end
  10.  
  11.     return function(...)
  12.         return pass(1, ...)
  13.     end
  14. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement