Aleksei-bird 7c9c708c92 Первый фикс
Пачки некоторых позиций увеличены
2024-03-01 20:54:33 +03:00

22 lines
765 B
Lua

local table = require('__stdlib__/stdlib/utils/table')
local function merge_additional_data(additional_data_array, data)
for _, new_data in pairs(additional_data_array) do
if type(new_data) == 'table' then
table.merge(data, table.deepcopy(new_data))
elseif type(new_data) == 'function' then
local new_data_func_result = new_data(data.index)
if type(new_data_func_result) == 'table' then
table.merge(data, new_data_func_result)
else
error('additional data function did not return a table')
end
else
error('additional data present but is not a function or table')
end
end
return data
end
return merge_additional_data