Advertisement
Starkkz

FD_LIB

Jul 24th, 2014
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.65 KB | None | 0 0
  1. fd_lib = {
  2.     FD_CLR = function (fd, set)
  3.         for i = 0, set.fd_count do
  4.             if set.fd_array[i] == fd then
  5.                 while i < set.fd_count-1
  6.                     set.fd_array[i] = set.fd_array[i + 1]
  7.                     i = i + 1
  8.                 end
  9.                 set.fd_count = set.fd_count - 1
  10.                 break
  11.             end
  12.         end
  13.     end,
  14.     FD_SET = function (fd, set)
  15.         local Index
  16.         for i = 0, set.fd_count do
  17.             if set.fd_array[i] == fd then
  18.                 Index = i
  19.                 break
  20.             end
  21.         end
  22.  
  23.         if Index = set.fd_count then
  24.             if set.fd_count < 64 then
  25.                 set.fd_array[i] = fd
  26.                 set.fd_count = set.fd_count + 1
  27.             end
  28.         end
  29.     end,
  30.     FD_ZERO = function (set)
  31.         set.fd_count = 0
  32.     end,
  33.     FD_ISSET = sock.__WSAFDIsSet,
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement