ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* getvariable
@ 2005-10-05 21:12 Thomas A. Schmitz
  2005-10-06  7:31 ` getvariable Hans Hagen
  0 siblings, 1 reply; 13+ messages in thread
From: Thomas A. Schmitz @ 2005-10-05 21:12 UTC (permalink / raw)


I thought I had understood at least some aspects of macros, but it  
turns out I'm as lost as always. Here's my problem:
I'm writing a module which will have a \setupcommand. The value is  
given in a [key=pair] list, so I thought I could use \getvariable.  
What I have is

\def\setupcommand{\setvariables[namespace]} % setting up the namespace
\setvariables[namespace][key=value,otherkey=value] % initializing the  
keys

% And now I want to wrap my values up in a conditional statement:
\doifelse{\getvariable{namespace}{key}}{value}
    {do something}
    {do something else}

When I put the \doifelse statement into my source files, the test  
works; the key is assigned the value that is in the setupcommand. But  
this doesn't work at runtime: either \getvariable{namespace}{key}  
always has the value I assign in the line \setvariables[namespace] 
[key=value,otherkey=value], or if I comment out that line, the  
variable is empty. I can see why this is the case: the setupcommand  
is read AFTER the module, so at runtime, the variable is not assigned  
yet. So my approach seems fundamentally flawed. What could I do instead?

Thanks for your help

Thomas

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2005-10-07 10:53 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-05 21:12 getvariable Thomas A. Schmitz
2005-10-06  7:31 ` getvariable Hans Hagen
2005-10-06  8:53   ` getvariable Thomas A. Schmitz
2005-10-06 10:01     ` getvariable Peter Rolf
2005-10-06 11:06       ` getvariable Thomas A. Schmitz
2005-10-06 12:45         ` getvariable Peter Rolf
2005-10-06 15:08           ` getvariable Thomas A. Schmitz
2005-10-06 20:08             ` getvariable Peter Rolf
2005-10-06 21:11               ` getvariable Thomas A. Schmitz
2005-10-07 10:53                 ` getvariable Peter Rolf
2005-10-06 21:32               ` getvariable Hans Hagen
2005-10-06 21:28       ` getvariable Hans Hagen
2005-10-06 21:27     ` getvariable Hans Hagen

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).