ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Testing non-existent counter in Lua
@ 2010-06-21 21:41 Jaroslav Hajtmar
  2010-06-22  5:55 ` Taco Hoekwater
  0 siblings, 1 reply; 4+ messages in thread
From: Jaroslav Hajtmar @ 2010-06-21 21:41 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi, all.

How do I know (due Lua) that the counter has not been defined in ConTeXt 
(through the command newcount)?

I am trying testing :

if tex.count.mycount == nil then...

or

if tex.count.mycount == 'error' then...

then when counter isnt defined due \newcount\mycount, then test ending 
with error message.

When counter is defined due
\newcount\mycount,
\mycount=1

then test
if tex.count.mycount == 1 then...

is OK...


Thanx, Jaroslav







___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Testing non-existent counter in Lua
  2010-06-21 21:41 Testing non-existent counter in Lua Jaroslav Hajtmar
@ 2010-06-22  5:55 ` Taco Hoekwater
  2010-06-22  6:35   ` Jaroslav Hajtmar
  0 siblings, 1 reply; 4+ messages in thread
From: Taco Hoekwater @ 2010-06-22  5:55 UTC (permalink / raw)
  To: hajtmar, mailing list for ConTeXt users

Jaroslav Hajtmar wrote:
> Hi, all.
> 
> How do I know (due Lua) that the counter has not been defined in ConTeXt 
> (through the command newcount)?
> 
> I am trying testing :
> 
> if tex.count.mycount == nil then...
> 
> or
> 
> if tex.count.mycount == 'error' then...
> 
> then when counter isnt defined due \newcount\mycount, then test ending 
> with error message.
> 
> When counter is defined due
> \newcount\mycount,
> \mycount=1
> 
> then test
> if tex.count.mycount == 1 then...

if token.command_name(token.create('mycount')) == 'assign_int'
    and tex.count.mycount == 1 then
    ...
end

Best wishes,
Taco

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Testing non-existent counter in Lua
  2010-06-22  5:55 ` Taco Hoekwater
@ 2010-06-22  6:35   ` Jaroslav Hajtmar
  2010-06-22  8:39     ` Taco Hoekwater
  0 siblings, 1 reply; 4+ messages in thread
From: Jaroslav Hajtmar @ 2010-06-22  6:35 UTC (permalink / raw)
  To: Taco Hoekwater; +Cc: mailing list for ConTeXt users

Thanx Taco,
can I learn about these things somewhere read more? I tried 
luatexref-t.pdf and I didnt in fact guided.

Thanx Jaroslav


Dne 22.6.2010 7:55, Taco Hoekwater napsal(a):
> Jaroslav Hajtmar wrote:
>> Hi, all.
>>
>> How do I know (due Lua) that the counter has not been defined in 
>> ConTeXt (through the command newcount)?
>>
>> I am trying testing :
>>
>> if tex.count.mycount == nil then...
>>
>> or
>>
>> if tex.count.mycount == 'error' then...
>>
>> then when counter isnt defined due \newcount\mycount, then test 
>> ending with error message.
>>
>> When counter is defined due
>> \newcount\mycount,
>> \mycount=1
>>
>> then test
>> if tex.count.mycount == 1 then...
>
> if token.command_name(token.create('mycount')) == 'assign_int'
>    and tex.count.mycount == 1 then
>    ...
> end
>
> Best wishes,
> Taco
>
>

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Testing non-existent counter in Lua
  2010-06-22  6:35   ` Jaroslav Hajtmar
@ 2010-06-22  8:39     ` Taco Hoekwater
  0 siblings, 0 replies; 4+ messages in thread
From: Taco Hoekwater @ 2010-06-22  8:39 UTC (permalink / raw)
  To: hajtmar; +Cc: mailing list for ConTeXt users



Jaroslav Hajtmar wrote:
> Thanx Taco,
> can I learn about these things somewhere read more? I tried
> luatexref-t.pdf and I didnt in fact guided.

It is in there, but as it goes in reference manuals, you have
to know what to look for. At this moment, there are no tutorials
or something like that about the token interface (mostly because
I am not quite happy with how it works right now).

Best wishes,
Taco

___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2010-06-22  8:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-21 21:41 Testing non-existent counter in Lua Jaroslav Hajtmar
2010-06-22  5:55 ` Taco Hoekwater
2010-06-22  6:35   ` Jaroslav Hajtmar
2010-06-22  8:39     ` Taco Hoekwater

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