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: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1365>
This commit is contained in:
Peter Hutterer 2025-11-17 15:11:01 +10:00
parent 32ed3060f9
commit a595f0bd48
2 changed files with 3 additions and 3 deletions

View file

@ -50,7 +50,7 @@ The Lua API available to plugins is limited to the following calls::
assert error ipairs next pairs tonumber assert error ipairs next pairs tonumber
pcall select print tostring type xpcall 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. It is not possible to e.g. use the ``io`` module from a script.

View file

@ -1221,8 +1221,8 @@ libinput_lua_plugin_init_lua(struct libinput *libinput,
luaopen_base(L); luaopen_base(L);
static const char *allowed_funcs[] = { static const char *allowed_funcs[] = {
"assert", "error", "ipairs", "next", "pcall", "pairs", "assert", "error", "ipairs", "next", "pcall", "pairs", "print",
"print", "select", "tonumber", "tostring", "type", "xpcall", "select", "tonumber", "tostring", "type", "xpcall", "_VERSION",
}; };
ARRAY_FOR_EACH(allowed_funcs, func) { ARRAY_FOR_EACH(allowed_funcs, func) {
lua_getglobal(L, *func); lua_getglobal(L, *func);