Not exactly sure why i got the error after pressing right arrow key until i reached the 'episodes' part of jellyfin. from the console, the problematic part seems to be here:
local function update_list()
overlay.data = ""
local magic_num = 29 -- const
list_start[layer] = list_start[layer] or 1 -- this one line fixed my "attempt to perform arithmetic on a nil value" error
if selection[layer] - list_start[layer] > magic_num then -- errored here
list_start[layer] = selection[layer] - magic_num
elseif selection[layer] - list_start[layer] < 0 then
list_start[layer] = selection[layer]
end
for i=list_start[layer],list_start[layer]+magic_num do
if i > #items then break end
local index = ""
if items[i].IndexNumber and items[i].IsFolder == false then
index = items[i].IndexNumber..". "
else
-- nothing
end
if i == selection[layer] then
overlay.data = overlay.data.."{\\fs16}{\\c&HFF&}"..index..items[i].Name.."\n"
else
overlay.data = overlay.data.."{\\fs16}"..index..items[i].Name.."\n"
end
end
overlay:update()
end
EDIT:
Seems like the amount of folders and lack of arrays in list_layer caused it to give the error.
For example:
Folder1 -> Folder2 -> Folder3 wouldn't produce the error as there are indeed 3 arrays.
Folder1 -> Folder2 -> Folder3 -> Folder4 would give a nil error since there are only 3 arrays, yet 4 layers(?)
So, by adding arrays as needed seems to have fixed it:
if #list_start < layer then table.insert(list_start, 1) end
Not exactly sure why i got the error after pressing
right arrow
key until i reached the 'episodes' part of jellyfin. from the console, the problematic part seems to be here:EDIT: Seems like the amount of folders and lack of arrays in
list_layer
caused it to give the error.For example:
Folder1
->Folder2
->Folder3
wouldn't produce the error as there are indeed 3 arrays.Folder1
->Folder2
->Folder3
->Folder4
would give anil
error since there are only 3 arrays, yet 4 layers(?)So, by adding arrays as needed seems to have fixed it: