diff --git a/File.c b/File.c index 2b17dce5..586efedc 100644 --- a/File.c +++ b/File.c @@ -1,3 +1,4 @@ +#include "general.h" #include "THFile.h" #include "luaT.h" diff --git a/general.h b/general.h index 62b17d41..4896adf5 100644 --- a/general.h +++ b/general.h @@ -15,4 +15,14 @@ #endif +#if LUA_VERSION_NUM >= 503 +/* one can simply enable LUA_COMPAT_5_2 to be backward compatible. +However, this does not work when we are trying to use system-installed lua, +hence these redefines +*/ +#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d))) +#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n))) +#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) +#endif + #endif