Table Search Question

mentat2963mentat2963 Member, PRO Posts: 11

I am using the TableSearch function in my game. In my table I have text cells which contain spaces between the words
like, "Item #3." However, GS does not seem to allow the KEY to have spaces in the TableSearch expression. When I try to enter "Item #3" I can only enter "Item#3" and the TableSearch function fails to find the text. Does anyone know how to address this problem?

Thanks!

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273

    In the expression editor, click alt+space to add a space into the expression. That should allow your function to find your key.

  • mentat2963mentat2963 Member, PRO Posts: 11

    I use a MAC so option+space did allow me to insert a space into the expression. However, the function still can't find the KEY even though the KEY is typed exactly as the text string appears in the table cell. I checked it a dozen times so I know I'm not crazy. Makes me think that there's a bug in GS.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited August 2015

    Spaces are never a good thing to have they can cause issues at specfic time with the code. It's always good practice to use a _ for a space like item_#3

  • ArmellineArmelline Member, PRO Posts: 5,368
    edited August 2015

    Option+Space is not the same as Space. There are two ways you can fix this, neither ideal.

    One is to make a new text attribute, put a space in it, and then use that in your search term - for example:

    "Item"..self.Space...."#3"

    Or just replace the spaces in your table with Option+Spaces.

    (When you use Option+Space to insert a space in the expression editor, you're actually inputting an entirely different character that just happens to also look like a space. So the search will fail, as it's looking for something different to what's in the table.)

  • mentat2963mentat2963 Member, PRO Posts: 11

    Thanks for the help, guys. I understand the issues now. I'm new to coding - I wonder why GS won't recognize spaces as just spaces and not special characters?

Sign In or Register to comment.