Returning arrays - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Returning arrays (
/showthread.php?tid=110670)
Returning arrays -
niCe - 27.11.2009
Hello,
is it possible to return string longer than 256 characters with a function? I tried even to put that string as a reference, but variable can't be both an array and a reference. I need this to update large strings with a function.
Thanks in advance,
niCe
Re: Returning arrays -
yezizhu - 27.11.2009
Array cannot mark as an reference because it's already an reference.
So u can do:
Code:
new
test[999];
test1(t[]){
t[sizeof(t)-1] = 'h';
}
In addition, return value can be any legal lenth.
Re: Returning arrays -
niCe - 27.11.2009
Ah so, I didn't know arrays are defaultly passed as a reference. Thanks!
Re: Returning arrays -
yezizhu - 28.11.2009
With first method, you don't need to add '&', array is already pass as an reference.
With secomd method, I guess u're using strtok.