From a2bf2bc1a1c679f87eee48daf79b973d107ebae1 Mon Sep 17 00:00:00 2001 From: Xertis <118364459+Xertis@users.noreply.github.com> Date: Sun, 8 Dec 2024 23:49:16 +0300 Subject: [PATCH 1/4] fix table.copy --- res/scripts/stdmin.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/res/scripts/stdmin.lua b/res/scripts/stdmin.lua index 14479c7d..3a895059 100644 --- a/res/scripts/stdmin.lua +++ b/res/scripts/stdmin.lua @@ -57,7 +57,11 @@ function table.copy(t) local copied = {} for k, v in pairs(t) do - copied[k] = v + if type(v) == "table" then + copied[k] = table.copy(v) + else + copied[k] = v + end end return copied From c5033dc6ff060d5da3527bf7104cfbfa01c92f8c Mon Sep 17 00:00:00 2001 From: Xertis <118364459+Xertis@users.noreply.github.com> Date: Mon, 9 Dec 2024 18:33:45 +0300 Subject: [PATCH 2/4] create table.deep_copy --- res/scripts/stdmin.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/res/scripts/stdmin.lua b/res/scripts/stdmin.lua index 3a895059..13934e06 100644 --- a/res/scripts/stdmin.lua +++ b/res/scripts/stdmin.lua @@ -56,9 +56,19 @@ end function table.copy(t) local copied = {} + for k, v in pairs(t) do + copied[k] = v + end + + 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.copy(v) + copied[k] = table.deep_copy(v) else copied[k] = v end From 8b1cf7338f43c3d11f0658aa3bd65fa47db77c9e Mon Sep 17 00:00:00 2001 From: Xertis <118364459+Xertis@users.noreply.github.com> Date: Mon, 9 Dec 2024 18:43:38 +0300 Subject: [PATCH 3/4] Update extensions.md --- doc/ru/scripting/extensions.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/ru/scripting/extensions.md b/doc/ru/scripting/extensions.md index d4502f64..d0ddd365 100644 --- a/doc/ru/scripting/extensions.md +++ b/doc/ru/scripting/extensions.md @@ -10,6 +10,12 @@ table.copy(t: table) -> table Создаёт и возвращает копию переданной таблицы путём создания новой и копирования в неё всех элементов из переданной. +```lua +table.deep_copy(t: table) -> table +``` + +Функция глубокого копирования создает полную копию исходной таблицы, включая все её вложенные таблицы. + ```lua table.count_pairs(t: table) -> integer ``` From 855f3c6d78220cfd0ba37c4a0d5a89f58dc8cd32 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Wed, 11 Dec 2024 20:18:13 +0300 Subject: [PATCH 4/4] add libluajit --- dev/AppImageBuilder.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/dev/AppImageBuilder.yml b/dev/AppImageBuilder.yml index 0231e1df..69e687e4 100644 --- a/dev/AppImageBuilder.yml +++ b/dev/AppImageBuilder.yml @@ -30,6 +30,7 @@ AppDir: - libogg0 - libvorbis0a - libvorbisfile3 + - libluajit-5.1-2 exclude: - hicolor-icon-theme - sound-theme-freedesktop