diff options
Diffstat (limited to 'challenge-107/stuart-little/lua/ch-2.lua')
| -rwxr-xr-x | challenge-107/stuart-little/lua/ch-2.lua | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/challenge-107/stuart-little/lua/ch-2.lua b/challenge-107/stuart-little/lua/ch-2.lua new file mode 100755 index 0000000000..52e1ab758d --- /dev/null +++ b/challenge-107/stuart-little/lua/ch-2.lua @@ -0,0 +1,24 @@ +#!/usr/bin/env lua + +-- run <script> + +function fns(t) + local res={} + for k,v in pairs(t) do + if type(v)=='function' then + res[k]=v + end + end + return res +end + +local Class={ + x="var", + y=1, + f1=function(x) return x^2 end, + f2=function(x,y) return x+y end, +} + +for k,v in pairs(fns(Class)) do + print(k,v) +end |
