mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Reduction of moose.lua sizing working now!
This commit is contained in:
30
Utils/luarocks/share/lua/5.1/luasrcdiet/utils.lua
Normal file
30
Utils/luarocks/share/lua/5.1/luasrcdiet/utils.lua
Normal file
@@ -0,0 +1,30 @@
|
||||
---------
|
||||
-- General utility functions.
|
||||
--
|
||||
-- **Note: This module is not part of public API!**
|
||||
----
|
||||
local ipairs = ipairs
|
||||
local pairs = pairs
|
||||
|
||||
local M = {}
|
||||
|
||||
--- Returns a new table containing the contents of all the given tables.
|
||||
-- Tables are iterated using @{pairs}, so this function is intended for tables
|
||||
-- that represent *associative arrays*. Entries with duplicate keys are
|
||||
-- overwritten with the values from a later table.
|
||||
--
|
||||
-- @tparam {table,...} ... The tables to merge.
|
||||
-- @treturn table A new table.
|
||||
function M.merge (...)
|
||||
local result = {}
|
||||
|
||||
for _, tab in ipairs{...} do
|
||||
for key, val in pairs(tab) do
|
||||
result[key] = val
|
||||
end
|
||||
end
|
||||
|
||||
return result
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user