View Single Post
  #9  
Unread 05-22-2013, 07:26 PM
Thurallor's Avatar
Thurallor Thurallor is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: May 2013
Posts: 202
Quote:
Originally Posted by Equendil
'Foreign' characters are encoded into UTF8. While the lua interpreter does not handle that encoding, lua strings are nothing more than arbitrary sequences of bytes, and they are transmitted to and fro the game engine and file system without change, so you generally don't need to worry about it for storing/retrieving strings.
Hi Equendil, thanks for the reply. I use your table browser plugin quite a lot.

Quote:
Full-proof code would probably require escaping line feeds and maybe other control characters though, as string literals within double quotes are supposed to be on one line.
Hmm, good point. And I do have some strings containing linefeeds. May explain some flaky behavior I've been seeing.

Edit: Maybe I can avoid the whole problem by using "long-bracket" literal strings: [[ ... ]].

Edit: Or by using string.format("%q", ...). Updated the source code.

Quote:
Edit: I also don't understand the purpose of "text = string.gsub(text, ",$", "");"
That's just me being anal. It turns

t = { "a", "b", }

into

t = { "a", "b" }

even though the former is completely acceptable in Lua. For the sake of maximizing efficiency, perhaps I should remove it.

Last edited by Thurallor : 05-25-2013 at 09:16 PM. Reason: afterthought
Reply With Quote