19 lines
401 B
Lua
19 lines
401 B
Lua
--- Utility functions.
|
|
-- @module advtrains_doc_integration.utils
|
|
-- @alias M
|
|
local M = {}
|
|
|
|
--- Create a table by applying a function to each element.
|
|
-- @tparam table tbl The table to map from.
|
|
-- @tparam function func The function to apply.
|
|
-- @treturn table The resulting table.
|
|
function M.map(tbl, func)
|
|
local t = {}
|
|
for k, v in pairs(tbl or {}) do
|
|
t[k] = func(v)
|
|
end
|
|
return t
|
|
end
|
|
|
|
return M
|