Forum

> > CS2D > Scripts > About quotation marks.
Forums overviewCS2D overview Scripts overviewLog in to reply

English About quotation marks.

4 replies
To the start Previous 1 Next To the start

old About quotation marks.

Powermonger
User Off Offline

Quote
Hi guys,

When I use command "sv_stopsound", this doesn't work:
1
2
file = "unrealsoftware.ogg"
parse("sv_stopsound "..file.." 1")

This doesn't work either:
1
file = ""unrealsoftware.ogg""

This DOES work:
1
2
file = ""..string.char(34).."unrealsoftware.ogg"..string.char(34)..""
parse("sv_stopsound "..file.." 1")

I know it looks silly, but it's the only one I could get to work.

Now my question is: Is there better/easier way to name the "file"?

Thanks!

old Re: About quotation marks.

Nekomata
User Off Offline

Quote
You don't need to rename the file, you require the escape slash.

1
parse("sv_stopsound \""..file.."\" 1")

This is when you need to use the quotes as well as in a string.

1
2
3
4
5
6
7
8
print("string")
-- will print
> string

-- And 
print("\"string\")
-- will print
> "string"

Works the same way with
1
print('\'string\'')

And using it with variables;
1
2
string = "hello world"
print(" \""..string.."\" - Nekomata 2015")


In a conclusion

You can do either;
Method#1 (recommended)
1
2
file = "unrealsoftware.ogg"
parse("sv_stopsound \""..file.."\" 1")

or Method#2
1
2
file = "\"unrealsoftware.ogg\""
parse("sv_stopsound "..file.." 1")

old Re: About quotation marks.

Powermonger
User Off Offline

Quote
user Nekomata has written
You don't need to rename the file, you require the escape slash.

1
parse("sv_stopsound \""..file.."\" 1")

This is when you need to use the quotes as well as in a string.

1
2
3
4
5
6
7
8
print("string")
-- will print
> string

-- And 
print("\"string\")
-- will print
> "string"

Works the same way with
1
print('\'string\'')

And using it with variables;
1
2
string = "hello world"
print(" \""..string.."\" - Nekomata 2015")


In a conclusion

You can do either;
Method#1 (recommended)
1
2
file = "unrealsoftware.ogg"
parse("sv_stopsound \""..file.."\" 1")

or Method#2
1
2
file = "\"unrealsoftware.ogg\""
parse("sv_stopsound "..file.." 1")


I thought I already tested that...
Because I have used double quotes before.
I must have done it wrong somehow... anyway,

It works as it should be, so that you very much for your help!

I hope your last week of October will be pleasant.


Problem is solved. Thread can be closed.

old Re: About quotation marks.

VaiN
User Off Offline

Quote
you can mix quotes to make this easier..

1
parse('sv_stopsound "'..file..'" 1')
double-quote is included in the string if it's inside of a single-quote. no escape needed.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview