From: Henning Hraban Ramm <hraban@fiee.net>
To: mailing ConTeXt users list for <ntg-context@ntg.nl>
Subject: Learning LuaTeX : Invoice
Date: Sun, 20 Feb 2011 12:55:20 +0100 [thread overview]
Message-ID: <13F84CC8-EB65-4D8E-B2F8-54D8CBE1B32A@fiee.net> (raw)
Maybe similar to the "spreadsheet" question:
I'm trying to use Wolfgang's letter module for my invoices and would
like to use Lua for the sums.
But I fail already at the beginning:
\startluacode
userdata = userdata or {}
userdata.invoice = userdata.invoice or { sum = 0 } -- global table for
sums
function userdata.singlesum(hours, perhour)
amount = hours * perhour
userdata.invoice.sum = userdata.invoice.sum + amount
global.context(string.gsub(string.format("\%.2f", amount), "%.", ","))
return amount
end
\stopluacode
gives:
(virtual://viafile.1 unknown preamble key [the character )] unknown
preamble key [the character )] unknown preamble key [the character )]
! LuaTeX error <main ctx instance>:1: '=' expected near '<eof>'.
system > tex > error on line 11 in file invoice.tex: LuaTeX
error ...
4 \startluacode
5 userdata = userdata or {}
6
7 userdata.invoice = userdata.invoice or { sum = 0 }
8
9 function userdata.singlesum(hours, perhour)
10 amount = hours * perhour
11 >> userdata.invoice.sum = userdata.invoice.sum + amount
12 global.context(string.gsub(string.format("\%.2f", amount),
"%.", ","))
13 return amount
14 end
I can't see what's wrong!?
I tried local and usercode, but didn’t get further.
Greetlings from Lake Constance!
Hraban
---
http://www.fiee.net/texnique/
http://wiki.contextgarden.net
https://www.cacert.org (I'm an assurer)
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
next reply other threads:[~2011-02-20 11:55 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-20 11:55 Henning Hraban Ramm [this message]
2011-02-20 12:07 ` Henning Hraban Ramm
2011-02-20 12:08 ` Wolfgang Schuster
2011-02-20 12:58 ` Henning Hraban Ramm
2011-02-20 13:29 ` Wolfgang Schuster
2011-02-20 13:29 ` Henning Hraban Ramm
2011-02-20 13:41 ` Wolfgang Schuster
2011-02-20 14:49 ` Henning Hraban Ramm
2011-02-20 15:12 ` Hans Hagen
2011-02-20 15:09 ` Hans Hagen
2011-02-20 19:16 ` Henning Hraban Ramm
2011-02-20 20:20 ` Philipp Gesang
2011-02-20 20:28 ` Wolfgang Schuster
2011-02-20 23:28 ` Hans Hagen
2011-02-22 9:47 ` Henning Hraban Ramm
2011-02-22 9:51 ` luigi scarso
2011-02-22 10:01 ` Wolfgang Schuster
2011-02-22 10:14 ` luigi scarso
2011-02-22 10:55 ` Henning Hraban Ramm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=13F84CC8-EB65-4D8E-B2F8-54D8CBE1B32A@fiee.net \
--to=hraban@fiee.net \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).