4 ms·
I've learned about them, staring endlessly at the luajit source code - for example (not the best example I can remember, but still) - https://github.com/LuaJIT/
by malkia 2y ago
I've learned about them, staring endlessly at the luajit source code - for example (not the best example I can remember, but still) - https://github.com/LuaJIT/LuaJIT/blob/v2.1/src/lj_lex.h#L15 https://github.com/LuaJIT/LuaJIT/blob/v2.1/src/lj_lex.h#L15
there it defines a TOKEN(_,__) macro generator the luajit token/keywords and later generates enums with them.
I've used it recently to wrap a "C" api with lots of functions, such that I can redirect calls.