webmcp

view framework/env/execute/_create_sorted_execution_list.lua @ 206:eb3e236d261d

Code cleanup and work on Moonbridge integration
author jbe
date Fri Jan 09 22:28:39 2015 +0100 (2015-01-09)
parents framework/env/execute/_add_filters_by_path.lua@a54cc7dcabf1
children 17baf126ea88
line source
1 function execute._create_sorted_execution_list(add_paths, execute_func)
2 local entries = {}
3 add_paths(function(...)
4 local full_path = encode.file_path(WEBMCP_BASE_PATH, "app", ...)
5 local relative_path = encode.file_path("", ...)
6 local filenames = extos.listdir(full_path)
7 if filenames then
8 table.sort(filenames) -- not really neccessary, due to sorting afterwards
9 for i, filename in ipairs(filenames) do
10 if string.find(filename, "%.lua$") then
11 if entries[filename] then
12 error('More than one filter or initializer is named "' .. filter_name .. '".')
13 end
14 entries[#entries+1] = filename
15 entries[filename] = function()
16 execute_func(
17 encode.file_path(full_path, filename),
18 encode.file_path(relative_path, filename)
19 )
20 end
21 end
22 end
23 end
24 end)
25 table.sort(entries)
26 for idx, filename in ipairs(entries) do
27 entries[idx] = enteries[filename]
28 entries[filename] = nil
29 end
30 return entries
31 end

Impressum / About Us