Print LuaJIT version in --version (#996)

When called with "--version", awesome prints the Lua version that it was
compiled against and the one that it is running against. This commit makes the
code detect LuaJIT and makes it print the LuaJIT version instead of an
unspecific "Lua 5.1".

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-07-09 19:05:44 +02:00 committed by Uli Schlachter
parent a93dc75cd6
commit 9d232c085c
1 changed files with 7 additions and 1 deletions

View File

@ -36,8 +36,14 @@ void
eprint_version(void) eprint_version(void)
{ {
lua_State *L = luaL_newstate(); lua_State *L = luaL_newstate();
luaopen_base(L); luaL_openlibs(L);
lua_getglobal(L, "_VERSION"); lua_getglobal(L, "_VERSION");
lua_getglobal(L, "jit");
if (lua_istable(L, 2))
lua_getfield(L, 2, "version");
else
lua_pop(L, 1);
#ifdef WITH_DBUS #ifdef WITH_DBUS
const char *has_dbus = ""; const char *has_dbus = "";