Re: [NTG-context] Storing Lua values between Ctx "*first* and next runs

2018-07-17 Thread Hans Hagen

On 7/14/2018 1:24 PM, Procházka Lukáš Ing. wrote:

Hello,

is there a Lua variable/namespace which is stored automatically between 
Ctx "*first" and following runs?


I thought 'userdata' is intended for this, but it seems it's not; I'd 
like to achieve something like:



\startluacode
   if tex.modes["*first"] then
     userdata.LPr = "Something"
     -- Is there a variable which is shared between Ctx runs?
   else
     assert(userdata.LPr == "Something")
   end
\stopluacode


Of course, I can store the table via serialization functions to an extra 
file, but I thought there is already a variable/mechanism for this (e.g. 
using .tua/.tuc file) ... is it?


search for datasets in the test suite

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] Storing Lua values between Ctx "*first* and next runs

2018-07-14 Thread Procházka Lukáš Ing .

Hello,

is there a Lua variable/namespace which is stored automatically between Ctx 
"*first" and following runs?

I thought 'userdata' is intended for this, but it seems it's not; I'd like to 
achieve something like:


\startluacode
  if tex.modes["*first"] then
userdata.LPr = "Something"
-- Is there a variable which is shared between Ctx runs?
  else
assert(userdata.LPr == "Something")
  end
\stopluacode


Of course, I can store the table via serialization functions to an extra file, 
but I thought there is already a variable/mechanism for this (e.g. using 
.tua/.tuc file) ... is it?

Best regards,

Lukas


--
Ing. Lukáš Procházka | mailto:l...@pontex.cz
Pontex s. r. o.  | mailto:pon...@pontex.cz | http://www.pontex.cz | 
IDDS:nrpt3sn
Bezová 1658
147 14 Praha 4

Mob.: +420 702 033 396

___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___