From b7ea5c97b899e7d552e5d05104b8c5665a44da18 Mon Sep 17 00:00:00 2001 From: Francois Perrad Date: Mon, 20 Mar 2017 19:01:33 +0100 Subject: [PATCH] add lua_version() --- src/lj_api.c | 5 +++++ src/lua.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/lj_api.c b/src/lj_api.c index 711c7e9d..7fd91226 100644 --- a/src/lj_api.c +++ b/src/lj_api.c @@ -112,6 +112,11 @@ LUA_API void lua_xmove(lua_State *from, lua_State *to, int n) from->top = f; } +LUA_API const lua_Number *lua_version (lua_State *L) { + static const lua_Number version = LUA_VERSION_NUM; + return &version; +} + /* -- Stack manipulation -------------------------------------------------- */ LUA_API int lua_gettop(lua_State *L) diff --git a/src/lua.h b/src/lua.h index 3d527401..f067483a 100644 --- a/src/lua.h +++ b/src/lua.h @@ -348,6 +348,7 @@ LUA_API void *lua_upvalueid (lua_State *L, int idx, int n); LUA_API void lua_upvaluejoin (lua_State *L, int idx1, int n1, int idx2, int n2); LUA_API int lua_loadx (lua_State *L, lua_Reader reader, void *dt, const char *chunkname, const char *mode); +LUA_API const lua_Number *lua_version (lua_State *L); struct lua_Debug {