Thanks for Wolfgang: your solution, that is
\setuprandomize[2012]
\define[3]\RandomCoeff{%
\setvalue{Coeff#1}{\ctxlua{tex.print(math.random(#2,#3))}}}
works indeed and it is somehow simpler than using \expandafter\csname, and as a
matter of fact, after reading your message I searched in the ConTeXt manuals
written by Hans, and found that \setvalue is defined on page 93 of
module-01.pdf as
\def\setvalue#1{\expandafter \def\csname#1\endcsname}
so it is better to use it.
Best regards: OK
On 5 janv. 2012, at 21:18, Wolfgang Schuster wrote:
>
> Am 05.01.2012 um 21:17 schrieb Peter Münster:
>
>> On Thu, Jan 05 2012, Otared Kavian wrote:
>>
>>> \define[3]\RandomCoeff{%
>>> \ctxlua{a = math.random(#2,#3)}
>>> % \csname{Coeff#1}\endcsname{\ctxlua{tex.print(a)}} %% this line does not
>>> work as expected...
>>
>> \setuprandomize[2012]
>> \define[3]\RandomCoeff{%
>> \expandafter\def\csname
>> Coeff#1\endcsname{\ctxlua{tex.print(math.random(#2,#3))}}}
>
> \setvalue{Coeff#1}{…}
>
> Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : [email protected] / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________