Raised This Month: $ Target: $400
 0% 

Returning string by reference


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
orglee
Member
Join Date: Dec 2005
Old 06-05-2009 , 19:44   Returning string by reference
Reply With Quote #1

How can I make a function set an argument passed to it to string?
Code:
function ReturnString(arg_1, &arg_2) { arg_2 = "some string" }
I'm calling function from other plugin using callfunc_* and after I've read over 20 topics it seems thats the only way to return a string.

Unfortunately that implementation gives me an error "Error: Must be assigned to an array on line 218" So I think the main question is... how to force type to String / Array on argument passed to function.
orglee is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-05-2009 , 20:33   Re: Returning string by reference
Reply With Quote #2

PHP Code:
public function(mystring[]) 
Also, I was told to use copy() to assign a string to an array variable.
__________________
fysiks is offline
orglee
Member
Join Date: Dec 2005
Old 06-05-2009 , 22:34   Re: Returning string by reference
Reply With Quote #3

Oh my goodness it was obvious...

But still I have a problem:
Code:
Error: Variable cannot be both a reference and an array (variable "sOutput") on line 185
Alright so how can I return a string from function called by callfunc_* I would like to omit returning some integer and loading that string from 'mother' plugin. But it seams that has to be done that way. :/
orglee is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-05-2009 , 22:40   Re: Returning string by reference
Reply With Quote #4

Sounds like you are trying to use &theVar[].

PHP Code:
new szTest[25];
fnTestszTest );
    
server_printszTest );

public 
fnTestszString[] )
{
    
formatexszString 25 "hello" );

__________________
Bugsy is offline
Reply



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 13:47.


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