RETURN
A Lingo predefined constant that is exactly equal to the string obtained by running numToChar( 13 ). This is the ASCII character for a carriage return, used to signal a newline in a block of text.
The constant RETURN should always be written in capital letters to differentiate it from the keyword return. While Lingo is not actually case sensitive and can work out the difference automatically, it may cause a great deal of confusion if you fail to follow this convention.
This constant can also be used to check whether the enter/return key has been pressed. For more information on this topic, see the entry for ENTER.
Note that when saving text files some different conventions are used on different platforms for specifying an end of line. There are two important ASCII characters:
- CR (carriage return), ASCII code 13
- LF (line feed), ASCII code 10
The different standards:
- On Macintosh, end of line is signalled by a single CR.
- On Windows (and most Internet protocols), end of line is signalled by CR+LF
- On Unix, end of line is signalled by a single LF.
You can create your own constants like so:
CR = numToChar( 13 ) -- Same as RETURN LF = numToChar( 10 ) CRLF = CR & LF
-- thePlatform is a hypothetical variable if( thePlatform = "windows" ) then EOL = CRLF else if( thePlatform = "unix" ) then EOL = LF else EOL = CR end if
Remember, internally Director follows the Macintosh convention of a single CR (RETURN) character for the end of a line. Use this for text members and fields, no matter what platform you are running on. You only need to worry about the diffent end of line characters when saving or loading text files.