[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Translating Lua keywords
- From: Dirk Laurie <dirk.laurie@...>
- Date: Wed, 10 Apr 2013 22:23:11 +0200
By editing the array of keywords `luaX_tokens` in llex.c, one can change
any of the keywords to another word (anything that would be a legal name
seems to be acceptable, but one can't for example change `and` to `&&`).
In one case it is not as easy as in the others.
"return" must be changed in the function "pushline" in lua.c too, in the
line
lua_pushfstring(L, "return %s", b+1); /* change it to `return' */
otherwise you can't use the "=" shortcut in the interactive interpreter.
This seems to be the only instance in the Lua source code outside the
definition of `luaX_tokens` where a keyword occurs hard-coded in a
string. The hard-coding can be avoided at the cost of making lua.c
include llex.h.