From 2a25c60a4f53fa48ef9625857a4dcd4b79049e5c Mon Sep 17 00:00:00 2001 From: Nero <41307858+nero@users.noreply.github.com> Date: Fri, 24 Jun 2022 20:28:02 +0000 Subject: [PATCH] Serializer Funktionen ausfaktorisieren, soll man auch einzeln einsetzen koennen --- Install_00/Install.ini | 1 + Install_00/Serializer.lua | 70 ++++++++++++++++++++++++++++++++++++ Install_00/kskit.lua | 75 +-------------------------------------- 3 files changed, 72 insertions(+), 74 deletions(-) create mode 100644 Install_00/Serializer.lua diff --git a/Install_00/Install.ini b/Install_00/Install.ini index 6b497cf..52dd346 100644 --- a/Install_00/Install.ini +++ b/Install_00/Install.ini @@ -4,3 +4,4 @@ File001 = "On.lua","LUA\On.lua" File002 = "Prototype.lua","LUA\Prototype.lua" File003 = "kskit.lua","LUA\kskit.lua" File004 = "Begriffe.lua","LUA\Begriffe.lua" +File005 = "Serializer.lua","LUA\Serializer.lua" diff --git a/Install_00/Serializer.lua b/Install_00/Serializer.lua new file mode 100644 index 0000000..3affff8 --- /dev/null +++ b/Install_00/Serializer.lua @@ -0,0 +1,70 @@ +-- Tabelle in einen String umwandeln, rekursiv +-- Funktionen als Lua-Werte werden ignoriert +function __tostring(tab) + local t=type(tab) + if t=="table" then + local r="" + -- Tabellen-Keys sammeln und sortieren + local tkeys={} + for k in pairs(tab) do table.insert(tkeys, k) end + table.sort(tkeys, function(a,b) return tostring(a)