I'm trying to display an image (a small star) when a selected game is in the favorites list.
I can access and display the [Favourite] magic token, which appears to be "" or "1" depending on whether the game is in the list. Also, though it behaves like a string, I can't seem to call the .tointeger() method so that I can test it as an integer. What is the proper way to test strings in squirrel? If someone could tell me where the flaw is in either of the following bits of code, I'd be very thankful:
//Try to test as string to display image
local Fav = "[Favourite]";
if ( Fav == "1" ) fe.add_image( "star.png", 220, 160, 16, 16 );
//Try to test as integer to display image
local Fav = "[Favourite]";
local FavValue = Fav.tointeger();
if ( FavValue == 1 ) fe.add_image( "star.png", 220, 160, 16, 16 );
Am I making a bonehead syntax error? Is [Favorite] not of type string? Is there a debugger that can tell me what errors I've thrown in code?