From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/61163 Path: news.gmane.org!not-for-mail From: Aditya Mahajan Newsgroups: gmane.comp.tex.context Subject: Re: ConTeXt meeting Lua tutorials Date: Mon, 23 Aug 2010 18:36:47 -0400 (EDT) Message-ID: References: <4C6FBCFE.4030904@elvenkind.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1282602754 18888 80.91.229.12 (23 Aug 2010 22:32:34 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 23 Aug 2010 22:32:34 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Tue Aug 24 00:32:32 2010 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OnfZA-000712-BD for gctc-ntg-context-518@m.gmane.org; Tue, 24 Aug 2010 00:32:32 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 4D100CA5C8; Tue, 24 Aug 2010 00:32:31 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id A2mfNIuNtpKm; Tue, 24 Aug 2010 00:32:28 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 6B436CA5BE; Tue, 24 Aug 2010 00:32:28 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 59D8BCA5BE for ; Tue, 24 Aug 2010 00:32:27 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id f9AiCgAAhm9B for ; Tue, 24 Aug 2010 00:32:15 +0200 (CEST) Original-Received: from filter1-til.mf.surf.net (filter1-til.mf.surf.net [194.171.167.217]) by balder.ntg.nl (Postfix) with ESMTP id EB17ECA5AA for ; Tue, 24 Aug 2010 00:32:14 +0200 (CEST) Original-Received: from tombraider.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.12.86]) by filter1-til.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id o7NMWCfj031838 for ; Tue, 24 Aug 2010 00:32:13 +0200 Original-Received: FROM [10.255.254.254] (Unknown [207.61.176.205]) By tombraider.mr.itd.umich.edu ID 4C72F6EA.6DB3C.20022 ; Authuser adityam; 23 Aug 2010 18:32:10 EDT In-Reply-To: <4C6FBCFE.4030904@elvenkind.com> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=141.211.12.86; country=US; region=MI; city=Ann Arbor; postalcode=48109; latitude=42.2923; longitude=-83.7145; metrocode=505; areacode=734; http://maps.google.com/maps?q=42.2923,-83.7145&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 08CVWwcNF - 74096481ab43 - 20100824 X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.217 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:61163 Archived-At: On Sat, 21 Aug 2010, Taco Hoekwater wrote: > Hi all, > > Today I started preparations for my activities at the ConTeXt meeting. > > There are two small lua tutorials in the program, and I am looking > for input on both. There is one that is supposed to be a general > beginner's introduction, and one specifically about fonts. > > For both, I am looking for input on what subjects I should cover? > > Since both tutorials will end up as articles/wiki pages, it makes > sense to ask everybody on the list for input (but requests by actual > attendees will be scored considerably higher). Some things that took a lot of trial and error for me to learn: * Write a macro that passes its argument as a string to a lua function * Write a macro that passes its argument as a function to a lua function * Write a macro that passes a lua function to another lua function. * Write a macro that passes an anonymous function to another lua function. For example, I should be able to do: \ToString{ABC with all " sorts ' of [[ weird [=[ characters [==[ [===[ [====[} \ToTable{ ['A'] = B, ['B'] = A } \ToFunction{ table.merge } \ToFunction{ function (a, b) do return (a+b) end } Slightly more advanced is how write a \setup command that can take these as an argument and pass it to a luafunction. For example \setupwhatever [ string={ABC with all " sorts ' of [[ weird [=[ charactes [===[ [====[", table={ ['A'] = B, ['B'] = A }, function = {table.merge}, anon={funcion (a,b) do return (a+b) end}, ] On hindsight, these are simple. But there is no documentaion on how lua sees the TeX arguments, and you need to understand how \directlua expands its arguments...something that can be very frustrating in the beginning. Aditya ___________________________________________________________________________________ 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 ___________________________________________________________________________________