-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update and expand docs #409
Conversation
Comments on the TODOs:
local uv = require('luv')
local check = uv.new_check()
uv.check_start(check, function()
print('loop iteration')
end)
uv.fs_scandir('.', function(err, req)
assert(not err, err)
while true do
local name, ftype = uv.fs_scandir_next(req)
if not name then break end
print(name, ftype)
end
uv.check_stop(check)
end)
uv.run() prints:
whereas: local uv = require('luv')
local dump = require('lib/utils').dump
local check = uv.new_check()
uv.check_start(check, function()
print('loop iteration')
end)
uv.fs_opendir('.', function(err, dir)
assert(not err, err)
local function readdir_cb(err, files)
assert(not err, err)
if files then
print(dump(files))
uv.fs_readdir(dir, readdir_cb)
else
assert(uv.fs_closedir(dir))
uv.check_stop(check)
end
end
uv.fs_readdir(dir, readdir_cb)
end)
uv.run() prints:
|
I was wrong about |
Most of the remaining sections are now done. I am going to ignore I added deprecation notices for I am going to defer documenting parameter types until a later date, if done at all. With the parameter names and function description, there is usually enough information to figure out the type (as in the Lua reference manual), but sometimes a table is nice at a glance:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, nice work. 👍
I think another way to improve them is to make sure all functions with callbacks specify what arguments the callbacks are called with, but that can be done later.
Thanks you nice job. |
First pass at improving docs.md.
Closes #118
Closes #144
Closes #378
This is a total rewrite so the diff might be overwhelming. Sorry that it's all one big commit. Since the previous version, I cleaned up or expanded the existing sections and added:
TODO
new_udp
andnew_tcp
flags - Documented.New change; haven't had a chance to look at it.translate_sys_error
- Ignored.This is the first error function exposed to Lua, so I'm not sure what this is doing here.uv_req_t
- Documented.We only expose(See uv.cancel #416)uv_cancel
but we might want to document which subtypes areuv_req_t
and which ones can be canceled.tcp_write_queue_size
- Deprecated.This isn't a libuv function, so I'm not sure what it's doing.tcp_close_reset
- Documented.Returned values are unclear to me.fs_readdir
- Documented.Behavior compared tofs_scandir_next
is unclear to me.I documented return types, but not parameters. This is going to be a bit of work, so I may save it for another time.