mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
fixes
This commit is contained in:
parent
4a9aad04ff
commit
1bea391f1d
4 changed files with 64 additions and 44 deletions
|
|
@ -90,19 +90,21 @@ network.tcp_connect = function(address, port, callback)
|
|||
end
|
||||
|
||||
network.udp_open = function (port, datagramHandler)
|
||||
if type(datagramHandler) ~= 'func' then
|
||||
if type(datagramHandler) ~= 'function' then
|
||||
error "udp server cannot be opened without datagram handler"
|
||||
end
|
||||
|
||||
local socket = setmetatable({id=network.__open_udp(port)}, DatagramServerSocket)
|
||||
|
||||
_udp_server_callbacks[socket.id] = datagramHandler
|
||||
_udp_server_callbacks[socket.id] = function(...)
|
||||
datagramHandler(socket, ...)
|
||||
end
|
||||
|
||||
return socket
|
||||
end
|
||||
|
||||
network.udp_connect = function (address, port, datagramHandler, openCallback)
|
||||
if type(datagramHandler) ~= 'func' then
|
||||
if type(datagramHandler) ~= 'function' then
|
||||
error "udp client socket cannot be opened without datagram handler"
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue