ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* reading the value of a counter (footnote counter, i.e.) from lua
@ 2016-06-15 14:47 massifr
  2016-06-15 15:09 ` Hans Hagen
  0 siblings, 1 reply; 4+ messages in thread
From: massifr @ 2016-06-15 14:47 UTC (permalink / raw)
  To: ntg-context

Hello list,
how can I read the numeric value of a counter in Lua?

local c_value = ...

Something like \rawcountervalue in ConTeXt, but in Lua.

Thanks in advance,
Massi
___________________________________________________________________________________
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: reading the value of a counter (footnote counter, i.e.) from lua
  2016-06-15 14:47 reading the value of a counter (footnote counter, i.e.) from lua massifr
@ 2016-06-15 15:09 ` Hans Hagen
  2016-06-15 15:33   ` massifr
  0 siblings, 1 reply; 4+ messages in thread
From: Hans Hagen @ 2016-06-15 15:09 UTC (permalink / raw)
  To: ntg-context

On 6/15/2016 4:47 PM, massifr@fastwebnet.it wrote:
> Hello list,
> how can I read the numeric value of a counter in Lua?
>
> local c_value = ...
>
> Something like \rawcountervalue in ConTeXt, but in Lua.

\starttext

x \footnote{x} x \footnote{x} x \footnote{x} x

\cldcontext{structures.counters.currentvalue("footnote",1)}

\stoptext

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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: reading the value of a counter (footnote counter, i.e.) from lua
  2016-06-15 15:09 ` Hans Hagen
@ 2016-06-15 15:33   ` massifr
  2016-06-15 15:36     ` Wolfgang Schuster
  0 siblings, 1 reply; 4+ messages in thread
From: massifr @ 2016-06-15 15:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users

> > how can I read the numeric value of a counter in Lua?
> >
> \starttext
> 
> x \footnote{x} x \footnote{x} x \footnote{x} x
> 
> \cldcontext{structures.counters.currentvalue("footnote",1)}
> 
> \stoptext

Thank you, Hans.

I searched for "currentvalue" in the source and now I'm looking at "strc-num.lua".
Is the second argument of currentvalue the level of a multi-level counter?
I suppose it is always 1 in footnotes, isn't it?

Best regards,
Massi
___________________________________________________________________________________
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: reading the value of a counter (footnote counter, i.e.) from lua
  2016-06-15 15:33   ` massifr
@ 2016-06-15 15:36     ` Wolfgang Schuster
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfgang Schuster @ 2016-06-15 15:36 UTC (permalink / raw)
  To: massifr, mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 396 bytes --]

> massifr@fastwebnet.it <mailto:massifr@fastwebnet.it>
> 15. Juni 2016 um 17:33
>
> Thank you, Hans.
>
> I searched for "currentvalue" in the source and now I'm looking at 
> "strc-num.lua".
> Is the second argument of currentvalue the level of a multi-level counter?
> I suppose it is always 1 in footnotes, isn't it?
No, you can also use 2 for \subfootnote and 3 for \subsubfootnote.

Wolfgang

[-- Attachment #1.2: Type: text/html, Size: 1364 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

___________________________________________________________________________________
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:[~2016-06-15 15:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-15 14:47 reading the value of a counter (footnote counter, i.e.) from lua massifr
2016-06-15 15:09 ` Hans Hagen
2016-06-15 15:33   ` massifr
2016-06-15 15:36     ` Wolfgang Schuster

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