mirror of
https://github.com/mpv-player/mpv
synced 2025-02-16 12:17:12 +00:00
lua: add mp.del_property()
This commit is contained in:
parent
2cfaa820e5
commit
51c6784df7
@ -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
|
||||
|
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user