Skip to content

Commit

Permalink
Merge branch 'main' into headless-mode
Browse files Browse the repository at this point in the history
  • Loading branch information
MihailRis committed Dec 11, 2024
2 parents 436bfd2 + 6040aa3 commit 60f2303
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions dev/AppImageBuilder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ AppDir:
- libogg0
- libvorbis0a
- libvorbisfile3
- libluajit-5.1-2
exclude:
- hicolor-icon-theme
- sound-theme-freedesktop
Expand Down
6 changes: 6 additions & 0 deletions doc/ru/scripting/extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ table.copy(t: table) -> table

Создаёт и возвращает копию переданной таблицы путём создания новой и копирования в неё всех элементов из переданной.

```lua
table.deep_copy(t: table) -> table
```

Функция глубокого копирования создает полную копию исходной таблицы, включая все её вложенные таблицы.

```lua
table.count_pairs(t: table) -> integer
```
Expand Down
14 changes: 14 additions & 0 deletions res/scripts/stdmin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,20 @@ function table.copy(t)
return copied
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)
local count = 0

Expand Down

0 comments on commit 60f2303

Please sign in to comment.