summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/lua.rst6
-rw-r--r--player/lua.c9
2 files changed, 15 insertions, 0 deletions
diff --git a/DOCS/man/lua.rst b/DOCS/man/lua.rst
index 546cf93a1d..ae9c14f55f 100644
--- a/DOCS/man/lua.rst
+++ b/DOCS/man/lua.rst
@@ -199,6 +199,12 @@ The ``mp`` module is preloaded, although it can be loaded manually with
Whether this works and how long it takes depends on the command and the
situation. The abort call itself is asynchronous. Does not return anything.
+``mp.del_property(name [,def])``
+ Delete the given property. See ``mp.get_property`` and `Properties`_ for more
+ information about properties. Most properties cannot be deleted.
+
+ Returns true on success, or ``nil, error`` on error.
+
``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
diff --git a/player/lua.c b/player/lua.c
index b3a7167dce..9b53b76465 100644
--- a/player/lua.c
+++ b/player/lua.c
@@ -613,6 +613,14 @@ static int script_commandv(lua_State *L)
return check_error(L, mpv_command(ctx->client, args));
}
+static int script_del_property(lua_State *L)
+{
+ struct script_ctx *ctx = get_ctx(L);
+ const char *p = luaL_checkstring(L, 1);
+
+ return check_error(L, mpv_del_property(ctx->client, p));
+}
+
static int script_set_property(lua_State *L)
{
struct script_ctx *ctx = get_ctx(L);
@@ -1219,6 +1227,7 @@ static const struct fn_entry main_fns[] = {
FN_ENTRY(get_property_bool),
FN_ENTRY(get_property_number),
AF_ENTRY(get_property_native),
+ FN_ENTRY(del_property),
FN_ENTRY(set_property),
FN_ENTRY(set_property_bool),
FN_ENTRY(set_property_number),