Garry's Mod Wiki

Revision Difference

File:ReadLine#515024

<function name="ReadLine" parent="File" type="classfunc">⤶ <description>⤶ Returns the contents of the file from the current position up until the end of the current line.⤶ ⤶ <note>This function will look specifically for `Line Feed` characters &amp;lt;pre class="plain inline"&amp;gt;\n&amp;lt;/pre&amp;gt; and will **completely ignore `Carriage Return` characters** &amp;lt;pre class="plain inline"&amp;gt;\r&amp;lt;/pre&amp;gt;.</note>⤶ <note>This function will not return more than 8192 characters.</note>⤶ </description>⤶ <realm>Shared</realm>⤶ <rets>⤶ <ret name="" type="string">The string of data from the read line.</ret>⤶ </rets>⤶ </function>⤶ ⤶ <example>⤶ <description>Open a file in read only mode, reads a line, tells where the current file pointer is at and then closes the file handle.</description>⤶ <code>⤶ local f = file.Open( "cfg/mapcycle.txt", "r", "MOD" )⤶ print( f:ReadLine() )⤶ print( f:ReadLine() )⤶ print( f:Tell() )⤶ f:Close()⤶ </code>⤶ <outputfixedwidth>Fixed width</outputfixedwidth>⤶ <output>⤶ //⤶ ⤶ // Default mapcycle file for Garry's Mod.⤶ ⤶ 45⤶ </output>⤶ ⤶ </example>