webmcp

view framework/env/execute/_create_sorted_execution_list.lua @ 405:c5f9a1b2f225

Updated year of copyright notice
author jbe
date Wed Jan 06 02:54:45 2016 +0100 (2016-01-06)
parents 17baf126ea88
children d7814e6d0124
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] = entries[filename]
28 entries[filename] = nil
29 end
30 return entries
31 end

Impressum / About Us