[dev-context] Storing and retrieving two-pass data

Marco netuse at lavabit.com
Wed Apr 18 12:55:18 CEST 2012


Hi,

I am trying to  save a string to the .tuc  file and to retrieve
it in the next run. My attempt:

\starttext
\startluacode
	local collected = utilities.storage.allocate()
	local tobesaved = utilities.storage.allocate()

	job.register("job.userdata", tobesaved)

	tobesaved["foo"] = "value_foo"
	tobesaved["bar"] = "value_bar"
\stopluacode
\stoptext

This leads to the following entry in the .tuc file:

utilitydata.job.userdata={
 ["bar"]="value_bar",
 ["foo"]="value_foo",
}

I  expected  to  be  able   to  retrieve  the  data  with  e.g.
collected["foo"], but the collected table is empty. What is the
interface to  retrieve the  values from  the .tuc  file? Aditya
mentioned  that there  will  be  a new  interface  in this  (or
the upcoming) beta.

Marco




More information about the dev-context mailing list