On Sun, 16 Jan 2011, Wolfgang Schuster wrote:
Am 15.01.2011 um 23:57 schrieb Aditya Mahajan:
What is the best way to define the equivalent of
\setvalue{\e!start\NAME}{...}
in lua.
e_start = ?? context.setvalue(e_start .. name, "...")
\startluacode context.setvalue("foo","\\framedtext") context.setvalue(table.concat({"start","foo"}),"\\startframedtext") context.setvalue(table.concat({"stop" ,"foo"}),"\\stopframedtext" ) \stopluacode
\starttext \foo{foo} \startfoo bar\stopfoo \stoptext
This would just create \startfoo. \setvalue{\e!start foo} creates a interface specific command. The code that Hans posted does that. I am sorry that this was not clear in the question.
You can also write “context.setvalue("start".."foo","…")” but table.concat looks better
OK.
but the question is why don’t you use just tex to create the start/stop commands.
Because I find it much easier to understand expansion at lua level than at TeX level. Thanks, Aditya