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