Array returned by a function
Hi. I've started a project and need to access an array from a different plugin to display a menu with options from that array. The only way I can think of is using callfunc to return that array.
I have plugin A with a function that returns the array. Code:
I have plugin B that uses callfunc to call the function in plugin A and now I need to copy/save/access the array returned in callfunc_end(). With integers is easy, I just set new variable = callfunc_end() but since it is returning an array this method doesn't work. I tried with copy(dest[], sizeof(dest), callfunc_end()) but I get an "Argument type mismatch" error on the callfunc_end() argument, where it expects an array. Code:
Thanks in advance. |
Re: Array returned by a function
In fact there ARE pointers in pawn. And that is how arrays are returned throughout the language. Example:
Code:
This will multiply each value in the input array and store it into the outputArray. Where you can then use outputArray to your needs. Simply put: you need to have the return array in the parameters of the function. as shown in formatex, copy, get_players, etc etc etc Hope i helped.... |
Re: Array returned by a function
Quote:
|
Re: Array returned by a function
Quote:
|
Re: Array returned by a function
Quote:
|
Re: Array returned by a function
Quote:
|
Re: Array returned by a function
Use dynamic natives and pass the array as an argument.
http://www.amxmodx.org/funcwiki.php?go=func&id=835 |
| All times are GMT -4. The time now is 06:14. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.