summaryrefslogtreecommitdiffstats
path: root/DOCS/man/input.rst
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-12-18 08:58:49 +0100
committerwm4 <wm4@nowhere>2019-12-18 08:58:49 +0100
commit7e4819e705d2f046de06fcff53ce151d835bbdad (patch)
treec775dc2f1517c05bfa2931c10ca8999b5cd7e63a /DOCS/man/input.rst
parent6ab013cbdd9d627f7cdd5eb1eca8df0da112b929 (diff)
downloadmpv-7e4819e705d2f046de06fcff53ce151d835bbdad.tar.bz2
mpv-7e4819e705d2f046de06fcff53ce151d835bbdad.tar.xz
command, lua: add a way to share data between scripts
Very primitive and dumb, but fulfils its purpose for the next commits. I chose this specific implementation because it has the lowest footprint in command.c, without resorting to crazy hacks such as sending messages between scripts (which would be hard to coordinate especially on startup).
Diffstat (limited to 'DOCS/man/input.rst')
-rw-r--r--DOCS/man/input.rst22
1 files changed, 22 insertions, 0 deletions
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index 0f6ec9430e..94e1f2fd27 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -2533,6 +2533,28 @@ Property list
``current-ao``
Current audio output driver (name as used with ``--ao``).
+``shared-script-properties`` (RW)
+ This is a key/value map of arbitrary strings shared between scripts for
+ general use. The player itself does not use any data in it (although some
+ builtin scripts may). The property is not preserved across player restarts.
+
+ This is very primitive, inefficient, and annoying to use. It's a makeshift
+ solution which could go away any time (for example, when a better solution
+ becomes available). This is also why this property has an annoying name. You
+ should avoid using it, unless you absolutely have to.
+
+ Lua scripting has helpers starting with ``utils.shared_script_property_``.
+ They are undocumented because you should not use this property. If you still
+ think you must, you should use the helpers instead of the property directly.
+
+ You are supposed to use the ``change-list`` command to modify the contents.
+ Reading, modifying, and writing the property manually could data loss if two
+ scripts update different keys at the same time due to lack of
+ synchronization. The Lua helpers take care of this.
+
+ (There is no way to ensure synchronization if two scripts try to update the
+ same key at the same time.)
+
``working-directory``
Return the working directory of the mpv process. Can be useful for JSON IPC
users, because the command line player usually works with relative paths.