History

lua: add mp.del_property()

rcombs committed 3 years ago

Commit 51c67841 parent 2cfaa822 files · +15 −0Browse files

Unified · Split

2 files
  1. DOCS/man/lua.rst +6 −0
  2. player/lua.c +9 −0
DOCS/man/lua.rst+6−0
@@ -199,6 +199,12 @@ The ``mp`` module is preloaded, although it can be loaded manually with · 198 unmodified lines
199 Whether this works and how long it takes depends on the command and the199 Whether this works and how long it takes depends on the command and the
200 situation. The abort call itself is asynchronous. Does not return anything.200 situation. The abort call itself is asynchronous. Does not return anything.
201 201
202``mp.del_property(name [,def])``
203 Delete the given property. See ``mp.get_property`` and `Properties`_ for more
204 information about properties. Most properties cannot be deleted.
205
206 Returns true on success, or ``nil, error`` on error.
207
202``mp.get_property(name [,def])``208``mp.get_property(name [,def])``
203 Return the value of the given property as string. These are the same209 Return the value of the given property as string. These are the same
204 properties as used in input.conf. See `Properties`_ for a list of210 properties as used in input.conf. See `Properties`_ for a list of
player/lua.c+9−0
@@ -613,6 +613,14 @@ static int script_commandv(lua_State *L) · 612 unmodified lines
613 return check_error(L, mpv_command(ctx->client, args));613 return check_error(L, mpv_command(ctx->client, args));
614}614}
615 615
616static int script_del_property(lua_State *L)
617{
618 struct script_ctx *ctx = get_ctx(L);
619 const char *p = luaL_checkstring(L, 1);
620
621 return check_error(L, mpv_del_property(ctx->client, p));
622}
623
616static int script_set_property(lua_State *L)624static int script_set_property(lua_State *L)
617{625{
618 struct script_ctx *ctx = get_ctx(L);626 struct script_ctx *ctx = get_ctx(L);
@@ -1219,6 +1227,7 @@ static const struct fn_entry main_fns[] = { · 600 unmodified lines
1219 FN_ENTRY(get_property_bool),1227 FN_ENTRY(get_property_bool),
1220 FN_ENTRY(get_property_number),1228 FN_ENTRY(get_property_number),
1221 AF_ENTRY(get_property_native),1229 AF_ENTRY(get_property_native),
1230 FN_ENTRY(del_property),
1222 FN_ENTRY(set_property),1231 FN_ENTRY(set_property),
1223 FN_ENTRY(set_property_bool),1232 FN_ENTRY(set_property_bool),
1224 FN_ENTRY(set_property_number),1233 FN_ENTRY(set_property_number),

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t