From 0e7f53a5bc76cc3f042791b5f8923563842224a3 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 17 Jul 2020 01:36:33 +0200 Subject: lua: add mp.get_env_list() function Because Lua is too stupid to provide this directly, and I sort of need it. --- DOCS/man/input.rst | 3 +++ DOCS/man/lua.rst | 4 ++++ 2 files changed, 7 insertions(+) (limited to 'DOCS/man') diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst index cf1bb5b4e9..eee5ba8614 100644 --- a/DOCS/man/input.rst +++ b/DOCS/man/input.rst @@ -539,6 +539,9 @@ Remember to quote string arguments in input.conf (see `Flat command syntax`_). useless.) The format of the list is as in the ``execle()`` syscall. Each string item defines an environment variable as in ``NANME=VALUE``. + On Lua, you may use ``utils.get_env_list()`` to retrieve the current + environment if you e.g. simply want to add a new variable. + The command returns the following result (as ``MPV_FORMAT_NODE_MAP``): ``status`` (``MPV_FORMAT_INT64``) diff --git a/DOCS/man/lua.rst b/DOCS/man/lua.rst index 9499847b58..88fb4cb7ce 100644 --- a/DOCS/man/lua.rst +++ b/DOCS/man/lua.rst @@ -826,6 +826,10 @@ strictly part of the guaranteed API. Returns the process ID of the running mpv process. This can be used to identify the calling mpv when launching (detached) subprocesses. +``utils.get_env_list()`` + Returns the C environment as a list of strings. (Do not confuse this with + the Lua "environment", which is an unrelated concept.) + ``utils.parse_json(str [, trail])`` Parses the given string argument as JSON, and returns it as a Lua table. On error, returns ``nil, error``. (Currently, ``error`` is just a string -- cgit v1.2.3