Am 18.04.2012 um 14:15 schrieb Marco: > On 2012-04-18 Wolfgang Schuster <schuster.wolfg...@googlemail.com> wrote: > >> The following works with the current beta, you can find another example in >> core-dat.mkiv. >> >> […] > > Thanks a lot. One more question: How to address the last element > without manually keeping track of how often it was saved? Anyhow, I > am just interested in the last saved value. A solution which simply > overwrites the old value every time would also be fine. > > \starttext > \definedataset [test] > \setdataset [test] [foo=first] > \setdataset [test] [foo=second] > > % I don't know that element "2" is the last > foo is: \datasetvariable{test}{2}{foo} > > % what I need > % foo is: \datasetvariable{test}{"last"}{foo} > \stoptext
\definedataset[test] \newcounter\testcounter % optional because \increment checks if the command is defined \startsetups dataset:test \doifvariable{test}{foo} { \doglobal\increment\testcounter \setdataset[test][foo=\getvariable{test}{foo}] } \stopsetups \setvariables[test][set=\texsetup{dataset:test}] \starttext \setvariables[test][foo=first] \setvariables[test][foo=second] foo is: \datasetvariable{test}{\testcounter}{foo} \stoptext Wolfgang _______________________________________________ dev-context mailing list dev-context@ntg.nl http://www.ntg.nl/mailman/listinfo/dev-context