Lua function returning a table as a nice formatted string

Achte bitte darauf, dass Du mit deinem Thema bzw. mit deiner Frage im richtigen Bereich bist.
Die Bereiche sind: Einstellungen im Forum, EEP aktuell ab EEP7 , Splines, Rollmaterialien, Immobilien, Landschaftselemente, Signale und Schaltung, Anlagenvorstellungen, Schnappschüsse Konstrukteure, EEP Treffen , Laberecke, Online - Handbuch EEP Vielen Dank für die Unterstützung das Forum übersichtlich zu halten.
Bilder/Fotos aus dem Internet sind nur als Link gestattet. Eigene Fotos, also Fotos aus dem realen Leben, sind erstens mit Eigenes Bild als Quellenangabe zu kennzeichnen und zweitens nur als Dateianhang im Beitrag zulässig. Bilder ohne Quellenangaben und Bilder dessen Quelle das Internet wie z. B. Google ist, werden gelöscht.
  • Hi,

    I created a function to return a table as a nice formatted string.

    I also included an iterator to sort the table.

    Windows 11 Pro 64bit

    Intel i9 9900k 8 cores @ 3.6 GHz, 32GB RAM

    NVidia GeForce RTX 2080 Ti 11GB

    Started in 2017 with EEP13, now using EEP17.2

    Groeten, Peter Nelissen :af_1:

    Einmal editiert, zuletzt von icke (LP1) (22. Mai 2020 um 23:29) aus folgendem Grund: edit to lua script

  • Hi Peter,

    I did something similar and showed the code in several messages starting here. The main differences to your code are:

    • I didn't worry about sorting.
    • I cared about re-creating the table from its textual representation.
    • And some more detailled stuff.

    By reading your source code, I expect some problems (not tested):

    • What, if a string itself contains an apostrophe?
    • What, if a table references itself (directly or indirectly)? Minimalistic example: a = {}; a[1] = a;
    • Tha name of your parameter full is somewhat misleading. sorted might be a better name?

    Nevertheless, a good start.

    Cheers

    Christopher

    PC: Intel i7-7700K; 64bit; 4,2 GHz; 32GB RAM; GeForce GTX 1080 (8 GB); Win 10, 22H2; EEP 6, 15 (Dev), 17.2 Plugins 1+2 (Dev); HomeNOS 17 (Dev)
    Laptop: Intel i7-12700H; 64bit; 2,7 GHz; 16GB RAM; GeForce RTX3070Ti (8 GB); Win 11, 23H2; EEP 6, 17 Plugins 1+2; HomeNOS 17 (User)