Re: Choice of processor

Joseph Wright <[email protected]> Wed, 5 Mar 2025 12:30:14 +0000
Newsgroups gmane.comp.tex.texhax
Message-ID <[email protected]>
On 05/03/2025 12:25, Philip Taylor wrote:
>
> On 05/03/2025 12:02, Joseph Wright wrote:
>> Indeed. What I've done is directly access the table of Lua functions (t
>> = lua.get_functions_table()) then added as index position 1 the
>> anonymous Lua function that will implement \strcmp. \luadef then links
>> the TeX token \strcmp to the Lua code at index position 1. The LuaTeX
>> manual covers this with some 'health warnings'.
> Thank you — (almost) all understood !  But how about the "12" in the
> following ?  Is that a TeX catcode (for "other") ?
>
>>   local minus_tok = token.new(string.byte('-'), 12)
>>   local zero_tok = token.new(string.byte('0'), 12)
>>   local one_tok = token.new(string.byte('1'), 12)

Yes - token.new() creates a character token with the given catcode -
compare with token.create() which will default to the current catcode
table. All covered (a bit) in the LuaTeX manual.

Joseph