Module macro.builtin
LuaMacro built-in macros.
Macros
def_ | a macro for defining lexically scoped simple macros. |
define_ | a global version of def_ . |
set_ | set the value of an existing macro. |
undef_ | undefining identifier macros. |
_END_ | Insert text after current block end. |
_END_END_ | insert an end after the next closing block. |
_END_CLOSE_ | insert a closing parens after next closing block. |
_STR_ | 'stringizing' macro. |
_PUSH_ | push a value onto a given macro' stack. |
_POP_ | pop a value from a macro's stack. |
_DROP_ | drop the top of a macro's stack. |
require_ | Load a Lua module immediately. |
include_ | Include the contents of a file. |
Macros
- def_
-
a macro for defining lexically scoped simple macros.
def_ may be followed by an arglist, and the substitution is the
rest of the line.
Usage:
def_ block (function() _END_CLOSE_
def_ sqr(x) ((x)*(x))
- define_
-
a global version of
def_
.see also:
- set_
-
set the value of an existing macro.
the name and value follows immediately, and the value must be
a single token
Usage:
set_ T 'string'
set_ F function
- undef_
- undefining identifier macros.
- _END_
-
Insert text after current block end.
_END_
is followed by a quoted string and is used to insert that string after the current block closes. - _END_END_
-
insert an end after the next closing block.
see also:
- _END_CLOSE_
-
insert a closing parens after next closing block.
Usage:
def_ begin (function() _END_CLOSE_ fun begin ... end --> fun (function() ... end)
see also:
- _STR_
-
'stringizing' macro.
Will convert its argument into a string.
Usage:
def_ _assert(x) assert(x,_STR_(x))
- _PUSH_
- push a value onto a given macro' stack.
- _POP_
-
pop a value from a macro's stack.
see also:
- _DROP_
-
drop the top of a macro's stack.
Like
_POP_
, except that it does not return the valuesee also:
- require_
- Load a Lua module immediately. This allows macro definitions to to be loaded before the rest of the file is parsed. If the module returns a function, then this is assumed to be a substitution function, allowing macro modules to insert code at this point.
- include_
-
Include the contents of a file.
This inserts the file directly
into the token stream, and is equivalent to cpp's
#include
directive.