lua-users home
lua-l archive

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


Am 27.06.2018 um 21:08 schröbte Egor Skriptunoff:
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");
#endif


Host program should be able to read lua_ident[0] (declared in "lua.h") to
detect Lua release in runtime.
This is a string, not a number.

There is also `LUA_VERSION_RELEASE[0]` 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.

Philipp