[NTG-context] final thoughts on experiments with lua

Schmitz Thomas A. thomas.schmitz at uni-bonn.de
Thu Jan 10 10:27:10 CET 2019



> On 10. Jan 2019, at 01:08, Hans Hagen <j.hagen at 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.

Best

Thomas


More information about the ntg-context mailing list