mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
make network.find_free_port return nil if not found
This commit is contained in:
parent
3725aacbb1
commit
5edd7b2bb5
1 changed files with 5 additions and 1 deletions
|
|
@ -410,7 +410,11 @@ static int l_get_total_download(lua::State* L, network::Network& network) {
|
|||
}
|
||||
|
||||
static int l_find_free_port(lua::State* L, network::Network& network) {
|
||||
return lua::pushinteger(L, network.findFreePort());
|
||||
int port = network.findFreePort();
|
||||
if (port == -1) {
|
||||
return 0;
|
||||
}
|
||||
return lua::pushinteger(L, port);
|
||||
}
|
||||
|
||||
static int l_set_nodelay(lua::State* L, network::Network& network) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue