mirror of
https://github.com/ctruLua/ctruLua.git
synced 2025-10-27 16:39:29 +00:00
Fixed tcpsocketobject:received when receiving less data than passed at arguments
It cuts the string at the end of received data.
This commit is contained in:
parent
a8d31de1e4
commit
d5f8202c69
1 changed files with 2 additions and 1 deletions
|
|
@ -200,7 +200,8 @@ static int socket_receive(lua_State *L) {
|
|||
}
|
||||
|
||||
char *buff = malloc(count);
|
||||
recv(userdata->socket, buff, count, flags);
|
||||
int len = recv(userdata->socket, buff, count, flags);
|
||||
*(buff+len) = 0x0; // text end
|
||||
|
||||
lua_pushstring(L, buff);
|
||||
return 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue