SA-MP Forums Archive
Any possible way of returning an array on public function? - 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: Any possible way of returning an array on public function? (/showthread.php?tid=324436)



Any possible way of returning an array on public function? - T0pAz - 09.03.2012

Fixed!


Re: Any possible way of returning an array on public function? - Vince - 09.03.2012

Pass it as argument to the function.
pawn Код:
stock myArrayFunc(array[], size = sizeof array)
{
    format(array, size, "This is a %s with the number %d", "string", 7);
}



Re: Any possible way of returning an array on public function? - T0pAz - 09.03.2012

Quote:
Originally Posted by Vince
Посмотреть сообщение
Pass it as argument to the function.
pawn Код:
stock myArrayFunc(array[], size = sizeof array)
{
    format(array, size, "This is a %s with the number %d", "string", 7);
}
I want to return it.


Re: Any possible way of returning an array on public function? - Vince - 09.03.2012

Public functions in fact cannot return arrays, so the only way to do is to pass the argument by reference.
Код:
error 090: public functions may not return arrays



Re: Any possible way of returning an array on public function? - T0pAz - 09.03.2012

Quote:
Originally Posted by Vince
Посмотреть сообщение
Public functions in fact cannot return arrays, so the only way to do is to pass the argument by reference.
Код:
error 090: public functions may not return arrays
Fixed using GVar.