2,732
edits
Red Leader (talk | contribs) (→readfile(): Finish doc) |
Red Leader (talk | contribs) (→Functions: Doc readln()) |
||
Line 241: | Line 241: | ||
=== readln(filehandle) === | === readln(filehandle) === | ||
Reads and returns a single | {{Nasal doc | ||
|syntax = io.readfile(file); | |||
|text = Reads and returns a single line from the file, advancing the position indicator. Accepts different {{wikipedia|newline}} types, including LF, CR, and CR+LF. Does not include the EOL character(s) in the returned string. End of file or an error is signaled by returning <code>'''nil'''</code>. | |||
|param1 = file | |||
|param1text = File object as returned by {{func link|open}}. | |||
|example1 = var path = getprop("/sim/fg-root") ~ '/Nasal/bits.nas'; | |||
var file = io.open(path); | |||
var line = io.readln(file); | |||
print(line); # prints "var bit = [var _ = 1];" | |||
line = io.readln(file); | |||
print(line); # prints "for (var i = 1; i < 32; i += 1)" | |||
}} | |||
=== readxml() === | === readxml() === |