[NTG-context] Learning LuaTeX : Invoice

Henning Hraban Ramm hraban at fiee.net
Tue Feb 22 11:55:54 CET 2011

Am 2011-02-22 um 11:14 schrieb luigi scarso:

>>> Can you add a small example ?
>> The spreadsheet module has a example at the end of the file and  
>> Hennings code
>> has also a example at the end.
> Yes I've seen
> But it' s better
> \startluacode
> -- functions
> \stopluacode
> %%
> \starttext
> \startluacode
> -- register invoice items
> userdata.RegisterAmountItem("Some introductional text", 0) -- just  
> text
> userdata.RegisterTimeItem("Learn \\LUATEX", 2.5)
> userdata.RegisterTimeItem("Do some calculations in \\CONTEXT", 3.5 +  
> 7)
> userdata.RegisterAmountItem("Donations to Open Source projects", 99)  
> -- lump sum
> -- output
> userdata.Invoice()
> \stopluacode
> \stoptext
> (or maybe a  better example)

Feel free to change it, it’s a wiki.

In my own document the functions live in an environment, together with  
all the definitions for the letter, and the invoice items in the  
actual invoice document. I wanted to make a rather minimal example, so  
I left out all the letter stuff.

The page is of use only for those who speak little Lua (I was looking  
for a similar example); if you know better, you won’t need it, and if  
you don’t speak Lua at all, it’s useless for you.

Greetlings from Lake Constance!
https://www.cacert.org (I'm an assurer)

More information about the ntg-context mailing list