lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

> > My lua code needs to deal with strings that contain \026 characters in them.


> There seems to be a confusion here. Lua strings can definitely contain all bytes, including control characters like \026. However, you should not put such binary > data directly inside *literal* strings that are fed to the Lua parser. You need to use escape sequences to encode all nonprintable characters. (The current

> implementation does tolerate most of those, but notably not newlines, and you should not count on this behavior.)


Thanks for all your suggestions. In my case the usage model is a bit more complicated. I use Lua linked to some C++ code that acts as a host and calls Lua functions to provide scripting functionality used mainly for testing. So ultimate Lua users and writers in my case are testers and it’s their scripts where *literal* strings with \026 characters come from. My current plan is to explain them that they can’t use \026 characters directly and have to escape them but ideally I’d like to avoid this. Any suggestions how to make their (and mine) life a bit easier are very welcome J