% language=us runpath=texruns:manuals/cld \startcomponent cld-macros \environment cld-environment \startchapter[title=Macros] \startsection[title={Introduction}] You can skip this chapter if you're not interested in defining macros or are quite content with defining them in \TEX. It's just an example of possible future interface definitions and it's not the fastest mechanism around. \stopsection \startsection[title={Parameters}] Right from the start \CONTEXT\ came with several user interfaces. As a consequence you need to take this into account when you write code that is supposed to work with interfaces other than the English one. The \TEX\ command: \starttyping \setupsomething[key=value] \stoptyping and the \LUA\ call: \starttyping context.setupsomething { key = value } \stoptyping are equivalent. However, all keys at the \TEX\ end eventually become English, but the values are unchanged. This means that when you code in \LUA\ you should use English keys and when dealing with assigned values later on, you need to translate them of compare with translations (which is easier). This is why in the \CONTEXT\ code you will see: \starttyping if somevalue == interfaces.variables.yes then ... end \stoptyping instead of: \starttyping if somevalue == "yes" then ... end \stoptyping \stopsection \startsection[title={User interfacing}] Unless this is somehow inhibited, users can write their own macros and this is done in the \TEX\ language. Passing data to macros is possible and looks like this: \starttyping \def\test#1#2{.. #1 .. #2 .. } \test{a}{b} \def\test[#1]#2{.. #1 .. #2 .. } \test[a]{b} \stoptyping Here \type {#1} and \type {#2} represent an argument and there can be at most 9 of them. The \type{[]} are delimiters and you can delimit in many ways so the following is also right: \starttyping \def\test(#1><#2){.. #1 .. #2 .. } \test(a>