f:seek

Sets and gets the current file position

Prototype

n = f:seek (whence, offset)

Description

Sets and gets the current file position.

f:seek () --> returns the current file position

When setting a position you can supply a string which is one of: The offset is a number from the base position.

f:seek ("set", 0)     -- go to start of file
f:seek ("end", -100)  -- go to 100 bytes from end of file
f:seek ("cur", 50)    -- go forwards 50 bytes

Lua functions

Topics