webmcp
annotate framework/env/execute/multi_wrapped.lua @ 31:1cd9e69b85cb
add execute.load_chunk(args)
load_chunk loads the content of a lua file and returns the code.
It can construct the path name easily so you can put helper code in
seperate files for DRYness.
load_chunk loads the content of a lua file and returns the code.
It can construct the path name easily so you can put helper code in
seperate files for DRYness.
author | Daniel Poelzleithner <poelzi@poelzi.org> |
---|---|
date | Tue Oct 05 02:34:04 2010 +0200 (2010-10-05) |
parents | 9fdfb27f8e67 |
children |
rev | line source |
---|---|
jbe/bsw@0 | 1 --[[-- |
jbe/bsw@0 | 2 execute.multi_wrapped( |
jbe/bsw@0 | 3 wrapper_funcs, -- multiple wrapper functions (i.e. filters) |
jbe/bsw@0 | 4 inner_func -- inner function (i.e. an action or view) |
jbe/bsw@0 | 5 ) |
jbe/bsw@0 | 6 |
jbe/bsw@0 | 7 This function does the same as execute.wrapped(...), but with multiple wrapper functions, instead of just one wrapper function. It is used by execute.filtered_view{...} and execute.filtered_action{...} to wrap multiple filters around the view or action. |
jbe/bsw@0 | 8 |
jbe/bsw@0 | 9 --]]-- |
jbe/bsw@0 | 10 |
jbe/bsw@0 | 11 function execute.multi_wrapped(wrapper_funcs, inner_func) |
jbe/bsw@0 | 12 local function wrapped_execution(pos) |
jbe/bsw@0 | 13 local wrapper_func = wrapper_funcs[pos] |
jbe/bsw@0 | 14 if wrapper_func then |
jbe/bsw@0 | 15 return execute.wrapped( |
jbe/bsw@0 | 16 wrapper_func, |
jbe/bsw@0 | 17 function() |
jbe/bsw@0 | 18 wrapped_execution(pos+1) |
jbe/bsw@0 | 19 end |
jbe/bsw@0 | 20 ) |
jbe/bsw@0 | 21 else |
jbe/bsw@0 | 22 return inner_func() |
jbe/bsw@0 | 23 end |
jbe/bsw@0 | 24 end |
jbe/bsw@0 | 25 return wrapped_execution(1) |
jbe/bsw@0 | 26 end |