From 896eee8b1f76fc1622dbef020a364bae6addbdd2 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 9 Jul 2016 19:05:44 +0200 Subject: [PATCH] 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 --- common/version.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/common/version.c b/common/version.c index fbd970e6..f5fbea5d 100644 --- a/common/version.c +++ b/common/version.c @@ -36,8 +36,14 @@ void eprint_version(void) { lua_State *L = luaL_newstate(); - luaopen_base(L); + luaL_openlibs(L); 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 const char *has_dbus = "✔";