[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: file:seek() documentation suggests whence is always optional, but its only sometimes optional (in 5.1/5.2),
- From: Sam Roberts <vieuxtech@...>
- Date: Tue, 29 Nov 2011 09:25:04 -0800
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