Table query question: Check if a string exists in a table
d.c.enright
Member Posts: 2
I want to check if a string entered by a player exists in a table as an if condition in a rule. I've poked at it a bit but can't seem to quite get it to work right. Is there a way I can basically get a bool returned from a table search?
Answers
Use the tableSearch function to search the table for the String. I have a few tableSearch demos on the forums and GSHelper.com
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
I have a tableSearch set up to search for the string (which is stored in an attribute) but I'm not sure what the tableSearch is returning, whether it finds it or not. Basically I need to check if a string is NOT in a table as a rule condition.
Start with this one, if you haven't yet:
http://forums.gamesalad.com/discussion/comment/452312/#Comment_452312
The tableSearch function returns the row or column number where the key is found or 0 if no key is found.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User