Raised This Month: $ Target: $400
 0% 

Array returned by a function


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
GoLoT
New Member
Join Date: Nov 2008
Old 06-23-2012 , 10:29   Array returned by a function
Reply With Quote #1

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:
public function() {   return someArray }

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:
new array[25] callfunc_begin("function", "pluginA.amxx") copy(array, sizeof(array), callfunc_end()) //Doesn't work
Afaik there are no pointers in pawn and the array returned isn't a copy but a reference/handle. How do you access the referenced array in callfunc_end()? And if there is a better way to access the array, please let me know.

Thanks in advance.
GoLoT is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:14.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode