Page 1 of 1

[0.13.6] [Oxyd] game.write_file handles data as zero terminated str

Posted: Fri Jul 08, 2016 10:44 am
by gheift
I created a lua function (see viewtopic.php?f=69&t=28550), which generates an image of the map (is there a native function for it?). Therefore I wanted to write a "\0" byte out (for coal) and detected data is handled as zero terminated string and not as a buffer and length.

Code: Select all

/c game.write_file("test.txt", string.char(65, 0, 66))
I expect the file to contain three bytes: "A\0B", but it contains only "A".

Re: [0.13.6] [Oxyd] game.write_file handles data as zero terminated str

Posted: Fri Jul 08, 2016 12:01 pm
by Oxyd
Fixed in 0.13.7.

Re: [0.13.6] [Oxyd] game.write_file handles data as zero terminated str

Posted: Fri Jul 08, 2016 12:14 pm
by gheift
Thanks!