Double quote mark problem...

gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

Hi, can't remember the best way to solve this any help appreciated, thanks:

I want to add a double quote mark to a text attribute but get Invalid Expression:

MyAtt.."""

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited January 2015

    Solved: I tried \" (MyAtt.."\"") and that's working now. I'll keep this thread here in case anyone else needs the solution at some other time.

  • HopscotchHopscotch Member, PRO Posts: 2,782
    edited January 2015

    @gyroscope‌ , escape the quote with a backslash ( \ ). Alt-Shift-7 if your keyboard does not have that key.

    e.g.

    MyAtt="She said: "

    Display Text MyAtt.."\"Hi\""

    will display

    She said: "Hi"

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Good to hear, @Hopscotch, thanks. :smile: (I'll try Alt-Shift-7 if it doesn't work on the iPad too - useful to know, thanks again).

  • SocksSocks London, UK.Member Posts: 12,822

    @gyroscope said:
    Good to hear, Hopscotch, thanks. :smile: (I'll try Alt-Shift-7 if it doesn't work on the iPad too - useful to know, thanks again).

    Another solution is to use two single quotes, so . . .

    "Your name is ".."''"..name.attribute.."''"

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Hi @Socks, Neat workaround, thanks (although \" seems to work OK on the device too). :smile:

  • ArmellineArmelline Member, PRO Posts: 5,421

    @gyroscope said:
    Hi Socks, Neat workaround, thanks (although \" seems to work OK on the device too). :smile:

    Escape characters are well established in pretty much every programming language including Lua so they should be entirely safe to use.

    There's actually a few more tricks you can use like that but only some are supported by GameSalad.

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    Useful to know, thanks @Armelline - + I'll bookmark that page from your link. :smile:

Sign In or Register to comment.