diff options
-rw-r--r-- | player/lua.c | 21 | ||||
-rw-r--r-- | player/lua/defaults.lua | 7 |
2 files changed, 7 insertions, 21 deletions
diff --git a/player/lua.c b/player/lua.c index 5a16c9202a..3621e7aee5 100644 --- a/player/lua.c +++ b/player/lua.c @@ -1024,26 +1024,6 @@ static int script_get_time(lua_State *L) return 1; } -static int script_input_define_section(lua_State *L) -{ - struct MPContext *mpctx = get_mpctx(L); - char *section = (char *)luaL_checkstring(L, 1); - char *contents = (char *)luaL_checkstring(L, 2); - char *flags = (char *)luaL_optstring(L, 3, ""); - bool builtin = true; - if (strcmp(flags, "default") == 0) { - builtin = true; - } else if (strcmp(flags, "force") == 0) { - builtin = false; - } else if (strcmp(flags, "") == 0) { - //pass - } else { - luaL_error(L, "invalid flags: '%s'", flags); - } - mp_input_define_section(mpctx->input, section, "<script>", contents, builtin); - return 0; -} - static int script_input_enable_section(lua_State *L) { struct MPContext *mpctx = get_mpctx(L); @@ -1321,7 +1301,6 @@ static const struct fn_entry main_fns[] = { FN_ENTRY(get_screen_margins), FN_ENTRY(get_mouse_pos), FN_ENTRY(get_time), - FN_ENTRY(input_define_section), FN_ENTRY(input_enable_section), FN_ENTRY(input_disable_section), FN_ENTRY(input_set_section_mouse_area), diff --git a/player/lua/defaults.lua b/player/lua/defaults.lua index 2ecb83fb77..bc9114ffa5 100644 --- a/player/lua/defaults.lua +++ b/player/lua/defaults.lua @@ -24,6 +24,13 @@ function mp.get_opt(key, def) return val end +function mp.input_define_section(section, contents, flags) + if flags == nil or flags == "" then + flags = "default" + end + mp.commandv("define-section", section, contents, flags) +end + -- For dispatching script_binding. This is sent as: -- script_message_to $script_name $binding_name $keystate -- The array is indexed by $binding_name, and has functions like this as value: |