lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


These macros are really cool.

However, while attempting to build a config set for an integer Lua, I ran into the problem of what to do on division (or mod) by 0. Of course, knowing that the macros are only used in lvm.c, I could just use L in the macro, but I can't help thinking that it would be that little bit cleaner to provide an L macro argument, which could just be left unused by macros which will never throw an error.

My plan was to put the int stuff into (a) luaconf.h file with:

#ifdef lvm_c

/* idiv, imod and ipow functions */

#define luai_numdiv(L, a, b) idiv(L, a, b)
#define luai_nummod(L, a, b) imod(L, a, b)
#define luai_numpow(L, a, b) ipow(a, b)

/* and the rest of the stuff */

#endif