Garry's Mod Wiki

Revision Difference

File:Seek#528705

<function name="Seek" parent="File" type="classfunc"> <description>Sets the file pointer to the specified position.</description> <realm>Shared and Menu</realm> <args> <arg name="pos" type="number">Pointer position.</arg> <arg name="pos" type="number">Pointer position, in bytes.</arg> </args> </function> ⤶ <example>⤶ <code>⤶ local f = file.Open( "test.txt", "w", "DATA" )⤶ f:WriteFloat( math.pi )⤶ f:WriteFloat( 66.99 )⤶ f:Close()⤶ ⤶ local f = file.Open( "test.txt", "r", "DATA" )⤶ f:Seek( 4 )⤶ print( f:ReadFloat() ) -- Prints 66.98999786377⤶ f:Close()⤶ </code>⤶ </example>