Blockland Forums > Modification Help
Send an array to the client
<< < (2/3) > >>
Headcrab Zombie:

--- Quote from: otto-san on January 02, 2012, 09:43:57 PM ---That could be a problem if the things are more than one word and not always a set amount of words.

--- End quote ---
Tab delimit it then.
Or new line if the elements already have tabs
Or some sort of special character if they have new lines too (but then you may want to write another function for breaking it apart)


--- Quote from: otto-san on January 02, 2012, 09:43:57 PM ---And also potential stack overflow.

--- End quote ---
I've only found this a problem if you echo the entire string.

Uristqwerty:

--- Code: ---%str = "Word!"; for(%i = 0; %i < 10240; %i++){%str = setword(%str, %i, getword(%str, %i - 1));}
--- End code ---
Won't overflow with just string operations.


A worse problem is that, I believe, it may cut off long strings when sent over the network, but that could have changed, or it could be fixed by sending the length first, and including a system to request later parts that were lost, or just send it in small chunks in the first place.
Headcrab Zombie:

--- Quote from: Uristqwerty on January 02, 2012, 10:19:53 PM ---A worse problem is that, I believe, it may cut off long strings when sent over the network

--- End quote ---
Now that you mention it, yeah, someone posted recently that they're limited to 255 bytes.

So disregard my suggestion
Ipquarx:
best way is to use a clientcmd with multiple arguments, up to 16 i believe. And if that's not enough, use multiple clientcmds.
Port:

--- Quote from: Ipquarx on January 03, 2012, 03:36:33 PM ---best way is to use a clientcmd with multiple arguments, up to 16 i believe. And if that's not enough, use multiple clientcmds.

--- End quote ---

You can have infinite arguments in any type of function. Although, with networked functions, data is cut off once reaching 255 bytes.
Navigation
Message Index
Next page
Previous page

Go to full version