diff options
author | wm4 <wm4@nowhere> | 2014-02-11 00:57:40 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-02-11 00:57:40 +0100 |
commit | 212d4e6061463e44e9333d7d0b99f10733bee22e (patch) | |
tree | 88426d29abad9316aaa06d056c644522c95f5957 /player/lua.c | |
parent | 33c6cbef3ab2be9ff8b818441b5cda101b913f15 (diff) | |
download | mpv-212d4e6061463e44e9333d7d0b99f10733bee22e.tar.bz2 mpv-212d4e6061463e44e9333d7d0b99f10733bee22e.tar.xz |
lua: some minor API changes
Diffstat (limited to 'player/lua.c')
-rw-r--r-- | player/lua.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/player/lua.c b/player/lua.c index 922b49417a..60cf4d2fcf 100644 --- a/player/lua.c +++ b/player/lua.c @@ -354,18 +354,20 @@ static int script_suspend(lua_State *L) static int script_resume(lua_State *L) { struct script_ctx *ctx = get_ctx(L); - static const char *modes[] = {"normal", "all", NULL}; - if (luaL_checkoption(L, 1, "normal", modes) == 1) { - if (ctx->suspended) - mpv_resume(ctx->client); - ctx->suspended = 0; - } else { - if (ctx->suspended < 1) - luaL_error(L, "trying to resume, but core is not suspended"); - ctx->suspended--; - if (!ctx->suspended) - mpv_resume(ctx->client); - } + if (ctx->suspended < 1) + luaL_error(L, "trying to resume, but core is not suspended"); + ctx->suspended--; + if (!ctx->suspended) + mpv_resume(ctx->client); + return 0; +} + +static int script_resume_all(lua_State *L) +{ + struct script_ctx *ctx = get_ctx(L); + if (ctx->suspended) + mpv_resume(ctx->client); + ctx->suspended = 0; return 0; } @@ -738,6 +740,7 @@ static struct fn_entry fn_list[] = { FN_ENTRY(log), FN_ENTRY(suspend), FN_ENTRY(resume), + FN_ENTRY(resume_all), FN_ENTRY(wait_event), FN_ENTRY(request_event), FN_ENTRY(find_config_file), |