On Thu, Jan 10, 2019 at 10:27 AM Schmitz Thomas A. <thomas.schmitz@uni-bonn.de> wrote:


> On 10. Jan 2019, at 01:08, Hans Hagen <j.hagen@xs4all.nl> wrote:
>
> it all depends on use ... if you can be more specific ...

Hans, Luigi,

thanks for your hints on list sorting - they are appreciated, but I’ve been there many many times: it’s impossible to be more specific because numbering can be unexpectedly weird. Combinations of Greek and Roman letters, sometimes (for historic reasons) even lines that are out of numeric sequence. I’ve tried to catch these exceptions in sort functions, only to have to add even more ifs and buts when I was processing the next author. And I’m pretty sure that the solution is not in sorting a table index: the correct sequence is already in the source, it just has to be preserved. What I do now, in a nutshell: I have tables such as

sections = { “1”, “2”, “2a” }

words = { [“1”] = { “a”, “b” },
          [“2a”] = { “c”, “d” } }

so I can iterate through ipairs(sections) in sequence and pick up the word lists for each section. In the greater scheme of things, as Hraban pointed out: if there were an “ordered table” structure in Lua, this is precisely what it would do behind the scenes; it would just make it easier for the user.

the point is that I believe that is also doable in lua...
maybe could be helpful to have a significative example in python, ton see if we can mimic it in lua  ?

--
luigi