Ok, as the title suggests, I am trying to send data FROM the server TO the client and add it to a ListBox.
Server Side Script (http://pastebin.com/raw/ENn5CJ0K)
Client Side Script (http://pastebin.com/raw/C2L3PkEG)
I can manually add an item to the ListBox, but cannot add the streamed data to it.
so my question is, what do I have to do to add the streamed data as an item in the ListBox ?
(I'm just assuming your server side script actually works, since player isn't defined in that function. I guess it's just an example. The culprit is in the client side)
The first thing that comes to mind to try is assigning a variable, then using that variable instead of the direct function call.
It doesn't make much sense why your code wouldn't work, but it's worth a shot...
local streamData = stream.ReadString();
Listbox.AddItem( streamData );
Quote from: Thijn on May 02, 2016, 04:52 PM(I'm just assuming your server side script actually works, since player isn't defined in that function. I guess it's just an example. The culprit is in the client side)
1. well noticed :-) yep, server side script works and it's just client side that's not working.
2. Already tried that, with no joy.
@Thijn I appologise, your method has solved the issue. topic solved.
I'd suggest
@maxorator to take a look at this. Why would another variable be needed, but printing the function result directly would work fine?
This seems unintended behavior.
Ok, just for
@maxorator this is the working example;
This places a ListBox in the bottom right hand side of the screen and fills it with the following test data sent from the server
0 rulk
1 rulk
2 rulk
Server Side Script (http://pastebin.com/raw/LAzj4WvB)
Client Side Script (http://pastebin.com/raw/n6u2xv5a)
Seems like intended behavior to me. The way streams work in most languages is that if you read something, the read position is automatically advanced, so if you have only one string in the stream, you can't read it twice in a row without resetting the stream.
Depends if it was sent as a reliable package. And I'm guessing that it's how they're sent.
Quote from: maxorator on May 02, 2016, 06:48 PMSeems like intended behavior to me. The way streams work in most languages is that if you read something, the read position is automatically advanced, so if you have only one string in the stream, you can't read it twice in a row without resetting the stream.
That makes sense. So removing the print should've fixed this snippet?
Quote from: Thijn on May 02, 2016, 08:57 PMQuote from: maxorator on May 02, 2016, 06:48 PMSeems like intended behavior to me. The way streams work in most languages is that if you read something, the read position is automatically advanced, so if you have only one string in the stream, you can't read it twice in a row without resetting the stream.
That makes sense. So removing the print should've fixed this snippet?
yeah. I got the point too, thanks, max. I had some problems understanding your test script which you cleared out.