Constant command

Ken Ray kray at sonsothunder.com
Thu Oct 14 19:16:42 EDT 2010


> Just noticed, in reading the dictionary on "constant" --
> 
> CR = return = LF = linefeed = numtochar(10)
> but
> "CRLF" is listed as "Equivalent to a carriage return (ASCII 13,
> Control-M) followed by a line feed (ASCII 10, Control-J)," implying
> that "carriage return" = numtochar(13) <> linefeed. Apparently,
> "carriage return" <> "CR" ... WTF?

I know it's a bit confusing, but CR is ASCII 10 (same as LF) *inside*
LiveCode; when you create a text file on disk, LiveCode will convert the
line endings *inside* LiveCode to the appropriate line endings for the
platform you're on.

The difference for the dictionary entry is that CRLF actually *is* ASCII 13
+ ASCII 10, whereas CR = ASCII 10 and LF = ASCII 10.

Try:

  answer charToNum(CR) & "/" & charToNum(LF)
  answer charToNum(char 1 of CRLF) & "/" & charToNum(char 2 of CRLF)

You should see "10/10" in the first dialog, and "13/10" in the second.

Hope this helps,

Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/





More information about the use-livecode mailing list