webmcp
view framework/env/execute/wrapped.lua @ 1:985024b16520
Version 1.0.1
New feature: JSON requests
Changes in ui.paginate: Current page setting is directly fetched from CGI params, instead of view params
Changed behavior of load methods of atom library to accept nil as input
Bugfixes in mondelefant_atom_connector timestamp(tz) loaders
Added global constant _WEBMCP_VERSION containing a version string
New feature: JSON requests
Changes in ui.paginate: Current page setting is directly fetched from CGI params, instead of view params
Changed behavior of load methods of atom library to accept nil as input
Bugfixes in mondelefant_atom_connector timestamp(tz) loaders
Added global constant _WEBMCP_VERSION containing a version string
| author | jbe | 
|---|---|
| date | Tue Nov 17 12:00:00 2009 +0100 (2009-11-17) | 
| parents | 9fdfb27f8e67 | 
| children | 
 line source
     1 --[[--
     2 execute.wrapped(
     3   wrapper_func,   -- function with an execute.inner() call inside
     4   inner_func      -- function which is executed when execute.inner() is called
     5 )
     7 This function takes two functions as argument. The first function is executed, and must contain one call of execute.inner() during its execution. When execute.inner() is called, the second function is executed. After the second function finished, program flow continues in the first function.
     9 --]]--
    11 function execute.wrapped(wrapper_func, inner_func)
    12   if
    13     type(wrapper_func) ~= "function" or
    14     type(inner_func) ~= "function"
    15   then
    16     error("Two functions need to be passed to execute.wrapped(...).")
    17   end
    18   local stack = execute._wrap_stack
    19   local pos = #stack + 1
    20   stack[pos] = inner_func
    21   wrapper_func()
    22   -- if stack[pos] then
    23   --   error("Wrapper function did not call execute.inner().")
    24   -- end
    25   stack[pos] = nil
    26 end
