diff options
| author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2026-02-06 17:43:10 -0800 |
|---|---|---|
| committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2026-02-06 17:43:10 -0800 |
| commit | 0cc08ff142621dac444d84be05bf9b6f4acd602b (patch) | |
| tree | 41b1b716c555efa5da8363077affd47ee2edc62b /state.lua | |
| parent | 1d93ccb330dca438322a0438b79eea718c4cf73b (diff) | |
| download | mpv-iptv-menu-0cc08ff142621dac444d84be05bf9b6f4acd602b.tar.gz mpv-iptv-menu-0cc08ff142621dac444d84be05bf9b6f4acd602b.tar.xz | |
Diffstat (limited to 'state.lua')
| -rw-r--r-- | state.lua | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -49,6 +49,30 @@ function mt:push_menu(t) return menu end +function mt:capture_origin(d) + local m = self.menus[d] + return { + menus = util.copy_table(self.menus), + depth = self.depth, + div_depth = d, + div_cursor = m.cursor, + div_view_top = m.view_top, + div_sort_f = m.sort_f, + } +end + +function mt:restore_origin(t) + self.menus = t.menus + self.depth = t.depth + local m = self.menus[t.div_depth] + m.cursor = t.div_cursor + m.view_top = t.div_view_top + + if m.sort_f ~= t.div_sort_f then + m:set_sort(t.div_sort_f) + end +end + -- returns index if found function mt:favourited(id) for i, v in ipairs(self.favourites) do |
