mirror of https://github.com/OpenMW/openmw.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
877 B
Lua
37 lines
877 B
Lua
local ui = require('openmw.ui')
|
|
|
|
---
|
|
-- `openmw_aux.ui` defines utility functions for UI.
|
|
-- Implementation can be found in `resources/vfs/openmw_aux/ui.lua`.
|
|
-- @module ui
|
|
-- @usage local auxUi = require('openmw_aux.ui')
|
|
local aux_ui = {}
|
|
|
|
local function deepContentCopy(content)
|
|
local result = ui.content{}
|
|
for _, v in ipairs(content) do
|
|
result:add(aux_ui.deepLayoutCopy(v))
|
|
end
|
|
return result
|
|
end
|
|
|
|
---
|
|
-- @function [parent=#ui] deepLayoutCopy
|
|
-- @param #table layout
|
|
-- @return #table copied layout
|
|
function aux_ui.deepLayoutCopy(layout)
|
|
local result = {}
|
|
for k, v in pairs(layout) do
|
|
if k == 'content' then
|
|
result[k] = deepContentCopy(v)
|
|
elseif type(v) == 'table' then
|
|
result[k] = aux_ui.deepLayoutCopy(v)
|
|
else
|
|
result[k] = v
|
|
end
|
|
end
|
|
return result
|
|
end
|
|
|
|
return aux_ui
|