webmcp

view framework/env/execute/_create_sorted_execution_list.lua @ 560:75204c64cc5f

Use CRLF instead of LF for terminating raw header
author jbe
date Tue Jun 09 13:27:58 2020 +0200 (7 months ago)
parents d7814e6d0124
children
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 "' .. filename .. '".')
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] = entries[filename]
28 entries[filename] = nil
29 end
30 return entries
31 end

Impressum / About Us