summaryrefslogtreecommitdiffstats
path: root/DOCS/man
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-02-17 00:19:30 +0100
committerwm4 <wm4@nowhere>2014-02-17 02:52:58 +0100
commit5fd661b50ea60f32e73249d14b0c118dc1ac5dc6 (patch)
tree160e58ff00eb999d677c9e1596d9f8d5846b916e /DOCS/man
parent1fa8e2b60203643019a11a84ac23d7a95ae714d1 (diff)
downloadmpv-5fd661b50ea60f32e73249d14b0c118dc1ac5dc6.tar.bz2
mpv-5fd661b50ea60f32e73249d14b0c118dc1ac5dc6.tar.xz
lua: allow giving fallback values in get_property() calls
E.g. ``mp.get_property("foo", "value")`` will return ``value`` if the property can't be read.
Diffstat (limited to 'DOCS/man')
-rw-r--r--DOCS/man/en/lua.rst14
1 files changed, 8 insertions, 6 deletions
diff --git a/DOCS/man/en/lua.rst b/DOCS/man/en/lua.rst
index 54b05d9ea5..046f2fe3ff 100644
--- a/DOCS/man/en/lua.rst
+++ b/DOCS/man/en/lua.rst
@@ -63,22 +63,24 @@ The ``mp`` module is preloaded, although it can be loaded manually with
These two commands are equivalent, except that the first version breaks
if the filename contains spaces or certain special characters.
-``mp.get_property(name)``
+``mp.get_property(name [,def])``
Return the value of the given property as string. These are the same
properties as used in input.conf. See `Properties`_ for a list of
properties. The returned string is formatted similar to ``${=name}``
(see `Property Expansion`_).
- Returns the string on success, or ``nil, error`` on error.
+ Returns the string on success, or ``def, error`` on error. ``def`` is the
+ second parameter provided to the function, and is nil if it's missing.
-``mp.get_property_osd(name)``
+``mp.get_property_osd(name [,def])``
Similar to ``mp.get_property``, but return the property value formatted for
OSD. This is the same string as printed with ``${name}`` when used in
input.conf.
- Returns the string on success, or ``"", error`` on error.
- Unlike ``get_property()``, assigning the return value to a variable will
- always result in a string.
+ Returns the string on success, or ``def, error`` on error. ``def`` is the
+ second parameter provided to the function, and is an empty string if it's
+ missing. Unlike ``get_property()``, assigning the return value to a variable
+ will always result in a string.
``mp.set_property(name, value)``
Set the given property to the given value. See ``mp.get_property`` and