[JW Lua] FCString:AppendEOL appends 0d 0d 0a on Windows ... more

Jari Williamsson jari.williamsson at mailbox.swipnet.se
Sat Aug 22 08:51:54 CEST 2015


Jan,

You're correct that text files in Lua shouldn't use AppendEOL. Text 
files in Lua works the same way as C text files. (Use "\n" for a new line.)

Best regards,

Jari Williamsson


On 2015-07-22 19:10, Jan Angermüller wrote:
> Hm, it seems more difficult than that:
> If I use  local outfile = io.open("c:\\test.txt", "w*b*") (=binary file)
> instead, the EOL output is fine: 0d 0a.
> If I use  local outfile = io.open("c:\\test.txt", "w"), the EOL output
> is: 0d 0d 0a.
> If I remove text:AppendEOL(), the end of the file is empty (no 0d at all
> !) no matter whether I use "wb" or "w".
> So maybe that's the typical Lua behaviour and I should use a binary file
> with "wb" although the result will be a text file.
>
> Jan
>
> -------- Weitergeleitete Nachricht --------
> Betreff: 	[JW Lua] FCString:AppendEOL appends 0d 0d 0a on Windows
> Datum: 	Wed, 22 Jul 2015 19:00:03 +0200
> Von: 	Jan Angermüller <jan at angermueller.com>
> Antwort an: 	The JW Lua script plug-in. <jwlua at jwmusic.nu>
> An: 	The JW Lua script plug-in. <jwlua at jwmusic.nu>
>
>
>
> Jari,
>
> FCString:AppendEOL() appends a "0d 0d 0a" instead of the typical "0d 0a"
> on Windows.
> Code snippet below.
>
> All the best,
> Jan
>
>
> local text=finale.FCString()
> text.LuaString="Test"
> text:AppendEOL()
> local outfile = io.open("c:\\test.txt", "w")
> outfile:write(text.LuaString)
> outfile:close()
>
> The created file then has the following hex codes:
> 54 65 73 74 0D 0D 0A
>
> (54 65 73 74 =="Test")
>
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>
>
>
>
>
> _______________________________________________
> JWLua mailing list
> JWLua at jwmusic.nu
> http://jwmusic.nu/mailman/listinfo/jwlua_jwmusic.nu
>






More information about the JWLua mailing list