22 Feb
2011
22 Feb
'11
11:55 a.m.
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! Hraban --- http://www.fiee.net/texnique/ http://wiki.contextgarden.net https://www.cacert.org (I'm an assurer)