How to use control characters in scripts



How to embed control characters in strings declared in ChaiScript ?

It seems that only some escape codes are supported, like “\n”, “\t”, etc.

How to declare a NULL character, or a character given a decimal value, i.e. “\d232” ?



Yes, only the major escape codes are supported. I need to do something else with extended / unicode / etc, but there’s nothing planned right now.

It is possible to initialize any individual character you want with something like char(232), if that helps.

Feel free to create an issue on github with a link to some specific standard you suggest we follow.


Thanks for the char() tip, I have used something like:
var s = char(232).to_string() + “ABCDEF”;

An other possibility is to replace a character in a string with s[0] = char(232);


This now fully works on the develop branch. Changes were just pushed up.


Thanks a lot.
It is really a pleasure to work with your library, having this great support.


No problem. It just so happened that I knew that the escape processing code was duplicated 2x and I knew it needed to be cleaned up, so you gave me a good excuse to tackle it.