webmcp

view framework/env/execute/_initializers.lua @ 255:9e4be058959d

New functions request.add_initializer(...) and request.add_variable(...) to allow per-request initialization; Merged request.process() with request.handler(...)
author jbe
date Sat Mar 14 23:39:47 2015 +0100 (2015-03-14)
parents f66037207da8
children 2ddbb44680f7
line source
1 function execute._initializers(initializer_path_element)
2 local yieldvalue = {}
3 local coro = coroutine.wrap(function()
4 execute.multi_wrapped(
5 execute._create_sorted_execution_list(
6 function(add_by_path)
7 add_by_path(initializer_path_element)
8 if WEBMCP_APP_NAME then -- allow for interactive mode
9 add_by_path(WEBMCP_APP_NAME, initializer_path_element)
10 end
11 end,
12 function(full_path, relative_path)
13 execute.file_path{ file_path = full_path }
14 end
15 ),
16 function()
17 coroutine.yield(yieldvalue)
18 end
19 )
20 return yieldvalue
21 end)
22 local function cont()
23 assert(coro() == yieldvalue, "Unexpected yield")
24 end
25 cont()
26 execute._finalizers[#execute._finalizers+1] = cont
27 end

Impressum / About Us