So a question that comes to mind is this: why is there no sane way for
the host program to detect the Lua minor version either at compile time
or runtime? In my code I have to expend a _lot_ of effort on a
workaround for one of the 5.3.4 bugs, but there's no good way for me to
detect whether I'm actually building against 5.3.5 in order to skip
(The only record of the minor version seems to be LUA_VERSION_RELEASE,
which is a string and not a number so it can't be used for conditionals
without doing ugly makefile tricks.)
int lua_ver = lua_version_release(L);
* if we're not using the workaround, check that we don't have the
if (lua_ver >= 50303 && lua_ver < 50305)
luaL_error(L, "Recompile with correct lua version");
But without minor version checks, I'm stuck having to use the workaround
all the time whether it's really needed or not.
> On Tue, Jun 26, 2018 at 2:32 PM, Andrew Gierth wrote:
>> So a question that comes to mind is this: why is there no sane way for
>> the host program to detect the Lua minor version either at compile time
>> or runtime?
>> #ifndef USE_BUG_WORKAROUND
>> int lua_ver = lua_version_release(L);
>> if (lua_ver >= 50303 && lua_ver < 50305)
>> luaL_error(L, "Recompile with correct lua version");
> Host program should be able to read lua_ident (declared in "lua.h") to
> detect Lua release in runtime.
> This is a string, not a number.
There is also `LUA_VERSION_RELEASE` which is a `char`, but also
requires runtime dispatch (or maybe not in C++?). That's the one I use
to set certain function pointers during initialization.