Difference between revisions of "Lua"
m (→ConTeXt Lua Extensions: converted to new templates for source links) |
m (Filename l-dimen.lua seems to have changed to util-dim.lua) |
||
Line 43: | Line 43: | ||
|{{src|l-boolean.lua|l-boolean.lua}}|| <tt>toboolean()</tt> – equivalent of <tt>tonumber()</tt> and <tt>tostring()</tt>; | |{{src|l-boolean.lua|l-boolean.lua}}|| <tt>toboolean()</tt> – equivalent of <tt>tonumber()</tt> and <tt>tostring()</tt>; | ||
|- | |- | ||
− | |{{src| | + | |{{src|util-dim.lua|util-dim.lua}} || Tex dimensions (accessible as ''number.*'' namespace); |
|- | |- | ||
|{{src|l-dir.lua|l-dir.lua}} || directory handling (globbing &c., namespace: ''dir.*''); | |{{src|l-dir.lua|l-dir.lua}} || directory handling (globbing &c., namespace: ''dir.*''); |
Revision as of 23:20, 28 July 2012
Contents
Introduction
MkIV is the current branch of the Context typesetting environment. As its underlying engine is supposed to be Luatex, MkIV is to a large extent implemented in Lua, as opposed to the legacy MkII which was written for Pdftex and Xetex as target engines.
As of now, documentation on the Lua guts of Context is somewhat rare. The definite guide is still the source code itself which, unfortunately, tends to be undercommented in many places. This portal-like wiki page is meant to gather links to existing documentation on Lua programming for Context/Luatex.
Documentation Links
General
- Recommended reading: current Luatex manual;
- Luatex mailing list;
- Metalink to all Lua topics;
- Some additional pointers may be found browsing Luatex.
Programming
- Introduction to Context’s interface to Lua;
- official Lua docs;
- the Luatex Wiki;
- Context Lua Documents;
- Running Lua Code Externally.
ConTeXt Lua Extensions
Context MkIV extends the vanilla Lua libraries by some very useful functionality. This pertains mostly to stuff people tend to implement over and over again because it is provided by default with other scripting languages. Thus, before you reimplement, say, a string stripping function for the thousandth time – have a look at these files:
File | Content |
---|---|
l-boolean.lua | toboolean() – equivalent of tonumber() and tostring(); |
util-dim.lua | Tex dimensions (accessible as number.* namespace); |
l-dir.lua | directory handling (globbing &c., namespace: dir.*); |
l-file.lua | filesystem related functions (namespace: file.*); |
l-io.lua | file/stream handling; |
l-lpeg.lua | pattern helpers; |
l-math.lua | extra functions for the Lua math library; |
l-md5.lua | checksum comparison, loading and saving; |
l-number.lua | additions to the number.* namespace – bitset handling; |
l-os.lua | additions to the os.* library, platform initialization; |
l-pdfview.lua | --autopdf handling of mtxrun; |
l-set.lua | set handling (set.* namespace); |
l-string.lua | string manipulation; |
l-table.lua | table manipulation; |
l-unicode.lua | extensions to the sln-unicode lib, converters for character encodings; |
l-url.lua | URI matching (namespace: url.*; also a nice tutorial on lpeg). |
Further Links
Places worth a visit when hunting for answers.
General
- http://www.luatex.org – the Luatex homepage;
- http://www.lua.org – the Lua homepage;
- http://www.ntg.nl/pipermail/ntg-context/ – the Context list archives;
- http://lua-users.org/lists/lua-l – lua-l, the Lua list;
- http://tex.stackexchange.com – some Questions might be answered here;
- [DE] http://www.luatex.de – Patrick’s blog.
Luatex Libs
- http://www.inf.puc-rio.br/~roberto/lpeg/lpeg.html – Roberto’s lpeg-page;
- http://www.keplerproject.org/luazip/ – Luazip;
- http://keplerproject.github.com/luafilesystem/ – Luafs;
- http://www.keplerproject.org/md5/ – Lua-md5;
- http://w3.impa.br/~diego/software/luasocket/ – LuaSocket;
- http://luaforge.net/projects/sln/ – Slnunicode;
- http://luaforge.net/projects/lzlib/ – Lua-Zlib.
Miscellanea
- Context may please everyone, but still it can’t hurt to occasionally visit the lualatex mailing list.