From a595f0bd48da7f90909fda57dbc7734924a49427 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 17 Nov 2025 15:11:01 +1000 Subject: [PATCH] lua: export _VERSION so plugins can check the lua version Since we only support one version this is not very informative but let's include this now in case we ever need it in the future. Part-of: --- doc/user/lua-plugins.rst | 2 +- src/libinput-plugin-lua.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/user/lua-plugins.rst b/doc/user/lua-plugins.rst index f7d7a55a..c2683266 100644 --- a/doc/user/lua-plugins.rst +++ b/doc/user/lua-plugins.rst @@ -50,7 +50,7 @@ The Lua API available to plugins is limited to the following calls:: assert error ipairs next pairs tonumber pcall select print tostring type xpcall - table string math + table string math _VERSION It is not possible to e.g. use the ``io`` module from a script. diff --git a/src/libinput-plugin-lua.c b/src/libinput-plugin-lua.c index 86158a60..c11998f3 100644 --- a/src/libinput-plugin-lua.c +++ b/src/libinput-plugin-lua.c @@ -1221,8 +1221,8 @@ libinput_lua_plugin_init_lua(struct libinput *libinput, luaopen_base(L); static const char *allowed_funcs[] = { - "assert", "error", "ipairs", "next", "pcall", "pairs", - "print", "select", "tonumber", "tostring", "type", "xpcall", + "assert", "error", "ipairs", "next", "pcall", "pairs", "print", + "select", "tonumber", "tostring", "type", "xpcall", "_VERSION", }; ARRAY_FOR_EACH(allowed_funcs, func) { lua_getglobal(L, *func);