alliedmodders / amxmodx

AMX Mod X - Half-Life 1 Scripting and Administration
http://www.amxmodx.org/
494 stars 197 forks source link

Double quotes do not compile #820

Open comingdemon opened 4 years ago

comingdemon commented 4 years ago

The example code

new string[] = "this is \"Hello world\" !";

A compiler error

error 001: expected token: ";", but found "-identifier-"
error 017: undefined symbol "Hello"

How to solve this problem?

Hope reply

voed commented 4 years ago

AMXMODX using ^ as escape character, so your string should be "this is ^"Hello world^" !";

comingdemon commented 4 years ago

AMXMODX using ^ as escape character, so your string should be "this is ^"Hello world^" !";

OK,thanks

OciXCrom commented 4 years ago

You can also modify this behavior and use \ instead:

#pragma ctrlchar '\'

RetroDev64 commented 4 years ago

Just a side comment: Why does AMXX use '^' as escape control key by default instead of '\' (like most languages do)?