[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Literal string strangeness
- From: Chris de Villiers <chrisdevilliers@...>
- Date: Fri, 23 Oct 2009 12:27:42 +0200
Hi all
I am struggling with the long format for specifying literal strings in
programs. Here is my program:
------------------------------------
s = [[a
bc]]
print(string.byte(s, 1, string.len(s)))
------------------------------------
Unfortunately I am loosing a carriage return in the string. Here is a
hexdump of the code to clarify:
7320 3d20 5b5b 610a 620d 635d 5d0a 0a70 s = [[a.b.c]]..p
7269 6e74 2873 7472 696e 672e 6279 7465 rint(string.byte
2873 2c20 312c 2073 7472 696e 672e 6c65 (s, 1, string.le
6e28 7329 2929 0a0a n(s)))..
You will notice there is a newline between the "a" and "b", and a
carriage return between the "b" and "c". Here is the output as
interpreted by the standard Lua interpreter:
97 10 98 10 99
I would have expected a 13 in place of the second 10. Any ideas?
I am using Lua 5.1.4 on linux. Thanx!
--
chris de villiers