Nasal library/io: Difference between revisions

m
Fix typos
(→‎Functions: Start write())
m (Fix typos)
Line 170: Line 170:
{{Nasal doc
{{Nasal doc
|syntax = io.read(file, buf, len);
|syntax = io.read(file, buf, len);
|text = Reads a given number of bytes from the given file and places those bytes into the given buffer. The bytes will be read from the position of the position indicator (this can be changed using {{func link|seek}}). Failures are thrown as runtime errors. Returns the number of bytes successfully read.
|text = Reads a given number of bytes from the given file and places those bytes into the given buffer. The bytes will be read from the position of the position indicator (this can be changed using {{func link|seek()}}). Failures are thrown as runtime errors. Returns the number of bytes successfully read.
|param1 = file
|param1 = file
|param1text = File object as returned by {{func link|open}}.
|param1text = File object as returned by {{func link|open()}}.
|param2 = buf
|param2 = buf
|param2text = Buffer to read bytes into. A new buffer can be created using <code>bits.buf(size)</code>. Must not be smaller than '''len'''.  
|param2text = Buffer to read bytes into. A new buffer can be created using <code>bits.buf(size)</code>. Must not be smaller than '''len'''.  
Line 339: Line 339:
|text = Returns the current pointer position of the file.
|text = Returns the current pointer position of the file.
|param1 = file
|param1 = file
|param1text = File object as returned by {{func link|open}}.
|param1text = File object as returned by {{func link|open()}}.
|example1 = var path = getprop("/sim/fg-root") ~ '/Nasal/geo.nas';
|example1 = var path = getprop("/sim/fg-root") ~ '/Nasal/geo.nas';
var file = io.open(path);
var file = io.open(path);