lua-users home
lua-l archive

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


Diego doesn't want to document capabilities that don't work the same
on linux and windows.

Here is example code (you can find him describing how to do this in
this list's archives).

Btw, you cannot meaningfully select() on files in linux. You can
select from them, but they always
return readable,so selecting on an io object, or the fd from an io
object probably doesn't do what you want.


--[[-
-- selectable = sockext.selectable(fd)

Return an object that can be used with socket.select() to select on a
arbitrary descriptor.

fd is an integer descriptor.
]]
function selectable(fd)
  fd = assert(tonumber(fd), "fd must be a number")
  local s = { fd = fd }
  function s:getfd() return fd end
  function s:dirty() return false end
  return s
end