Hi all,
Assuming that we have a set of words or expressions, say
{Maths, Physics, Algebra, Analysis, Chemistry, Geometry, Wave equation,
Schrödinger equation}
is it possible to write a lua function, named for instance
randomselectword
which returns one of the words or expressions
On 8-6-2011 6:52, Otared Kavian wrote:
Hi all,
Assuming that we have a set of words or expressions, say
{Maths, Physics, Algebra, Analysis, Chemistry, Geometry, Wave equation,
Schrödinger equation}
is it possible to write a lua function, named for instance
randomselectword
which
on"}\par}\stoptext
Mathieu
> From: ota...@gmail.com
> Date: Wed, 8 Jun 2011 18:52:36 +0200
> To: ntg-context@ntg.nl
> Subject: [NTG-context] Random selection of a word in a set with lua and mkiv
>
> Hi all,
>
> Assuming that we have a set of words or expressions, say
On 8-6-2011 7:00, Mathieu Dupont wrote:
This following code works, except that the first random is always the same
(Analysis) for some reason.
Anyone knows why ?
\enableregime[il1]\starttext\startluacode userdata = userdata or {} math.randomseed( os.time() )function userdata.ra
uation"}Thanks, that
fixes one of my problems !
Mathieu
> Date: Wed, 8 Jun 2011 19:07:50 +0200
> From: pra...@wxs.nl
> To: ntg-context@ntg.nl
> CC: mathieudup...@hotmail.com
> Subject: Re: [NTG-context] Random selection of a word in a set with lua and
> mkiv
>
&
t;}\par}
> \stoptext
>
>
>
> Mathieu
>
>
>
>
> > From: ota...@gmail.com
> > Date: Wed, 8 Jun 2011 18:52:36 +0200
> > To: ntg-context@ntg.nl
> > Subject: [NTG-context] Random selection of a word in a set with lua and mkiv
> >
> &
On 8-6-2011 10:12, Otared Kavian wrote:
Thank you very much for your quick thoughts and solutions!
It is amazing how fast one gets a solution to one's problem on this list…
well, this was an easy one -)
Just a note for Mathieu: I think that
\enableregime[il1]
depends on the input e