SA-MP Forums Archive
String array sizes - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: String array sizes (/showthread.php?tid=286878)



String array sizes - rt-2 - 01.10.2011

Hi,
I just have a simple question:

Why some coder stop their strings size to [256].. i use to stop mine at [300], is that why my script is sometimes unstable?

thanks


Re: String array sizes - grand.Theft.Otto - 01.10.2011

I recommend string sizes 128 or lower. 300 is way too much and in-efficient for your script.

The string size means how many characters/letters are going to be in your string/message. You can always use at least [50] for small text strings, but remember: if a player's name and id with a message all appear in one string/line, I would recommend a bigger string size, like 128, not 50.

300 is useless, in-efficient and uses up a lot of computer resources.


Re: String array sizes - Dolby - 01.10.2011

In this case,256 = cells,In Other Words,if you define 256,you can use 256 letters.

You can use this: http://projogos.com.br/GeradoresJFS/GeradorCelula.html to count the you letters,to not wasting cells.


Re: String array sizes - Rachael - 01.10.2011

Obviously defining smaller string arrays will reduce memory usage. It will not change cpu usage.

To answer the original question, the number 256 is a nice round number in coding terms because it is 2 ^ 8 or
2x2x2x2x2x2x2x2 = 256

This does not make it in any way a better default size for string arrays


Re: String array sizes - DRIFT_HUNTER - 01.10.2011

https://sampforum.blast.hk/showthread.php?tid=55261