lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Args are documented to be:

    file:seek ([whence] [, offset])

but the args don't independently have defaults. This call is invalid:

    f:seek(16) -- whence defaults to "cur"

docs should say

    file:seek([whence [, offset]])

to be consistent with doc conventions in the manual (see string.find,
string.byte).

Too bad, I like the documented behaviour, it would be implementable
(check if there is only two args - self, ? - and then
if the second arg is TSTRING it's a whence and if it's TNUMBER it's an
offset), and its useful, I tried to do  this and found
its failure puzzling:

  f=io.open(args[1],"r+")
  assert(f:seek(16))
  f:write("\255\255")

Cheers,
Sam