ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Henning Hraban Ramm <texml@fiee.net>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: final thoughts on experiments with lua
Date: Thu, 10 Jan 2019 12:11:08 +0100	[thread overview]
Message-ID: <5797F962-D863-48B1-B528-385C2F7DE2C5@fiee.net> (raw)
In-Reply-To: <CAG5iGsCoM=SSYW+YdSS4vd25xPd4m0=tS3zVJiyU0+8k=H8fLA@mail.gmail.com>

Am 2019-01-10 um 10:50 schrieb luigi scarso <luigi.scarso@gmail.com>:

>> 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  ?

The "minimal example" in Python is a collections.OrderedDict. It’s not about ordering the entries (anew), but keeping the order, i.e. retrieving the entries in the same order as you added them. If you iterate over a Python dict or a Lua pairs table, the order can be arbitrary.

Greetlings, Hraban
---
https://www.fiee.net
http://wiki.contextgarden.net
https://www.dreiviertelhaus.de
GPG Key ID 1C9B22FD

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2019-01-10 11:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-09 19:57 Thomas A. Schmitz
2019-01-09 20:12 ` luigi scarso
2019-01-09 20:38 ` Alan Braslau
2019-01-10  0:09   ` Hans Hagen
2019-01-10  0:08 ` Hans Hagen
2019-01-10  9:27   ` Schmitz Thomas A.
2019-01-10  9:50     ` luigi scarso
2019-01-10 11:11       ` Henning Hraban Ramm [this message]
2019-01-10 12:09         ` Hans Hagen
2019-01-10 14:53         ` luigi scarso
2019-01-10  7:03 ` Henning Hraban Ramm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5797F962-D863-48B1-B528-385C2F7DE2C5@fiee.net \
    --to=texml@fiee.net \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).