While using the following code if I move from last filter to first (loop) or move backwards from first filter to last i get the error "Slice out of range". Lets say the filters are Action, Adventure, Horror, Shooter. When I try to go from Shooter to Action (its a loop) I get the error. If I move back from Action to Shooter, I get the same error. No error/ issues while moving within Action - Shooter, the error is only coming up when moving to start or end of loop i.e. before action or after shooter. Can anyone please help in this regard?
The code being used is:
//Get First Letter of Title and Adjust Non-Alphabetical Chars
function first_letter ()
{
local first_char = rstrip(fe.game_info(Info.Title)).slice(0,1);
local expression = regexp("[a-zA-Z]");
if (expression.match(first_char) == true) return first_char
else return "#";
}
local indicator_text = fe.add_text( "[!first_letter]",7, 0, 40, 40);
indicator_text.font="BebasNeue Book.ttf";
indicator_text.set_rgb(203,203,203);
indicator_text.style = Style.Bold;
indicator_text.align = Align.MiddleCentre;
indicator_text.charsize = 38;
I am using Leap plugin but doesn't seem like a leap issue because its working within the loop and works without issue in places where some empty filters are "leaped"