lua-users home
lua-l archive

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


>From kleiser@online.no Mon Jan 19 21:37:46 1998
>lua_dostring's. After a few more minutes it was clear: When you use
>lua_dofile's, the Carriage Returns in the Mac files get translated into
>Linefeeds; when you use lua_dostring's, they don't. For some reason Lua

That's correct and that's what an ANSI C compiler for the Mac should do.
In C, you should *always* use \n as a line separator in strings.

>dostring("print(1)\r$debug\rprint(2)")
>prin syntax error;$d
>Active Stack:
>    function dostring [in file (C)]
>    main of (dostring) >> dostring("print(1)\r at line 1

I get the very same error when I run your example code on a Sun,
which uses \n as end-of-line.
So, the error is correct and expected.

>It think a few words on this LF/CR/separator subject would be fine in the
>Lua documentation ;)

Like I said, you should *always* use \n as a line separator in strings,
as if you were going to write them out.

--lhf