mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
Merge branch 'main' into headless-mode
This commit is contained in:
commit
60f2303137
3 changed files with 21 additions and 0 deletions
|
|
@ -30,6 +30,7 @@ AppDir:
|
||||||
- libogg0
|
- libogg0
|
||||||
- libvorbis0a
|
- libvorbis0a
|
||||||
- libvorbisfile3
|
- libvorbisfile3
|
||||||
|
- libluajit-5.1-2
|
||||||
exclude:
|
exclude:
|
||||||
- hicolor-icon-theme
|
- hicolor-icon-theme
|
||||||
- sound-theme-freedesktop
|
- sound-theme-freedesktop
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,12 @@ table.copy(t: table) -> table
|
||||||
|
|
||||||
Создаёт и возвращает копию переданной таблицы путём создания новой и копирования в неё всех элементов из переданной.
|
Создаёт и возвращает копию переданной таблицы путём создания новой и копирования в неё всех элементов из переданной.
|
||||||
|
|
||||||
|
```lua
|
||||||
|
table.deep_copy(t: table) -> table
|
||||||
|
```
|
||||||
|
|
||||||
|
Функция глубокого копирования создает полную копию исходной таблицы, включая все её вложенные таблицы.
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
table.count_pairs(t: table) -> integer
|
table.count_pairs(t: table) -> integer
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,20 @@ function table.copy(t)
|
||||||
return copied
|
return copied
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function table.deep_copy(t)
|
||||||
|
local copied = {}
|
||||||
|
|
||||||
|
for k, v in pairs(t) do
|
||||||
|
if type(v) == "table" then
|
||||||
|
copied[k] = table.deep_copy(v)
|
||||||
|
else
|
||||||
|
copied[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return copied
|
||||||
|
end
|
||||||
|
|
||||||
function table.count_pairs(t)
|
function table.count_pairs(t)
|
||||||
local count = 0
|
local count = 0
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue