* [NTG-context] Lua with xtable
@ 2026-02-27 15:15 Fabrice Couvreur
2026-02-27 16:46 ` [NTG-context] " Wolfgang Schuster
0 siblings, 1 reply; 3+ messages in thread
From: Fabrice Couvreur @ 2026-02-27 15:15 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hi,
Can someone tell me where the error is in this code ?
Thanks for your help.
Fabrice
\starttext
\startluacode
context.startxtable({"align={middle,lohi},bodyfont=9pt"})
context.startxrow({"background=color,backgroundcolor=lightgray"})
context.startxcell({"background=color,backgroundcolor=white,width=0.6cm"})
context("")
context.stopxcell()
context.startxcell({"width=0.6cm"})
context("A")
context.stopxcell()
context.startxcell({"width=1.5cm"})
context("B")
context.stopxcell()
context.stopxrow()
context.startxrow()
context.startxcell({"width=0.6cm"})
context("1")
context.stopxcell()
context.startxcell()
context("\\im{n}")
context.stopxcell()
context.startxcell()
context("\\im{u_n}")
context.stopxcell()
context.stopxrow()
local p = {}
p[8] = 511
for i= 9, 17 do
context.startxrow()
context.startxcell() context(i-8) context.stopxcell()
context.startxcell() context(i) context.stopxcell()
context.startxcell() context("%0.3f", p[i]) context.stopxcell()
context.stopxrow()
p[i] =512*(1-1/(2^(i+1)))
end
context.stopxtable()
\stopluacode
\stoptext
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* [NTG-context] Re: Lua with xtable
2026-02-27 15:15 [NTG-context] Lua with xtable Fabrice Couvreur
@ 2026-02-27 16:46 ` Wolfgang Schuster
2026-02-27 17:05 ` Fabrice Couvreur
0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Schuster @ 2026-02-27 16:46 UTC (permalink / raw)
To: ntg-context
Am 27.02.2026 um 16:15 schrieb Fabrice Couvreur:
> Hi,
> Can someone tell me where the error is in this code ?
> Thanks for your help.
> Fabrice
>
> context.startxcell() context("%0.3f", p[i]) context.stopxcell()
> context.stopxrow()
> p[i] =512*(1-1/(2^(i+1)))
You try to get the value of p[i] before it has been set.
Move p[i] = ... to the begin of the loop and it will work.
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* [NTG-context] Re: Lua with xtable
2026-02-27 16:46 ` [NTG-context] " Wolfgang Schuster
@ 2026-02-27 17:05 ` Fabrice Couvreur
0 siblings, 0 replies; 3+ messages in thread
From: Fabrice Couvreur @ 2026-02-27 17:05 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hello Wolfgang,
Exactly, I should have paid more attention !
Thank you
Fabrice
Le ven. 27 févr. 2026 à 17:47, Wolfgang Schuster
<wolfgang.schuster.lists@gmail.com> a écrit :
>
> Am 27.02.2026 um 16:15 schrieb Fabrice Couvreur:
> > Hi,
> > Can someone tell me where the error is in this code ?
> > Thanks for your help.
> > Fabrice
> >
> > context.startxcell() context("%0.3f", p[i]) context.stopxcell()
> > context.stopxrow()
> > p[i] =512*(1-1/(2^(i+1)))
>
> You try to get the value of p[i] before it has been set.
>
> Move p[i] = ... to the begin of the loop and it will work.
>
> Wolfgang
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
> ___________________________________________________________________________________
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-02-27 17:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-27 15:15 [NTG-context] Lua with xtable Fabrice Couvreur
2026-02-27 16:46 ` [NTG-context] " Wolfgang Schuster
2026-02-27 17:05 ` Fabrice Couvreur
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).