[NTG-context] Learning LuaTeX : Invoice

luigi scarso luigi.scarso at gmail.com
Tue Feb 22 11:14:59 CET 2011


On Tue, Feb 22, 2011 at 11:01 AM, Wolfgang Schuster
<schuster.wolfgang at googlemail.com> wrote:
>
> Am 22.02.2011 um 10:51 schrieb luigi scarso:
>
>> On Tue, Feb 22, 2011 at 10:47 AM, Henning Hraban Ramm <hraban at fiee.net> wrote:
>>> Am 2011-02-20 um 21:20 schrieb Philipp Gesang:
>>>>
>>>> Anyways, looking forward to see your invoice code
>>>
>>> Here you are:
>>> http://wiki.contextgarden.net/Calculations_in_Lua
>>>
>>> It’s just in a "works for me" state, and the page can go away as soon as the
>>> spreadsheet module goes live.
>> 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
-- 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()

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)

-- 
luigi


More information about the ntg-context mailing list