Replace deprecated `table.getn` function with length operator `#` - mpv-jellyfin - MPV script for adding an interface for Jellyfin.
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 7aef1c8f0dfbf7c68456d03bde28d8f972c20617
(DIR) parent 25c2df0372b1fef15b36401bb9e66c313a037e0c
(HTM) Author: Sebastien MacDougall-Landry <60635017+EmperorPenguin18@users.noreply.github.com>
Date: Tue, 21 Feb 2023 21:55:36 -0500
Replace deprecated `table.getn` function with length operator `#`
Diffstat:
M scripts/jellyfin.lua | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
(DIR) diff --git a/scripts/jellyfin.lua b/scripts/jellyfin.lua
@@ -150,7 +150,7 @@ end
local function key_up()
selection = selection - 1
- if selection == 0 then selection = table.getn(items) end
+ if selection == 0 then selection = #items end
update_data()
end
@@ -176,7 +176,7 @@ end
local function key_down()
selection = selection + 1
- if selection > table.getn(items) then selection = 1 end
+ if selection > #items then selection = 1 end
update_data()
end
@@ -225,7 +225,7 @@ toggle_overlay = function()
mp.add_forced_key_binding("DOWN", "jdown", key_down, { repeatable = true })
mp.add_forced_key_binding("LEFT", "jleft", key_left)
if not connected then connect() end
- if table.getn(items) == 0 then
+ if #items == 0 then
update_overlay()
else
update_data()