SA-MP Forums Archive
Y_master - 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: Y_master (/showthread.php?tid=586972)



Y_master - detter - 26.08.2015

How do i define and use functions with a string as the return.

With this i have one error in the main script ( argument type mismatch) (no errors in FS):

Код:
foreign getSomeString();

global getSomeString() {
 new test[20];
 test = "This is a test";
 return test;
}



Re: Y_master - detter - 27.08.2015

*bump


Re: Y_master - Crayder - 27.08.2015

pawn Код:
global getSomeString(&test[]) {
    test = "This is a test";
}
Use:
pawn Код:
new str[20];
getSomeString(str);
print(str);//Will print "This is a test"



Re: Y_master - detter - 27.08.2015

Clever ,but:

Код:
 "variable cannot be both a reference and an array"



Re: Y_master - Crayder - 27.08.2015

Quote:
Originally Posted by detter
Посмотреть сообщение
Clever ,but:

Код:
 "variable cannot be both a reference and an array"
You're right, I forgot about that. Strings can't be references... I've never played with y_master too much so I don't know what to say...

Perhaps you should report this on github.


Re: Y_master - Ahmad45123 - 27.08.2015

As Crayder said, Create an issue in the github with a Question tag and ****** himself will help you.


Re: Y_master - Crayder - 27.08.2015

Quote:
Originally Posted by Ahmad45123
Посмотреть сообщение
As Crayder said, Create an issue in the github with a Question tag and ****** himself will help you.
No... It's not a question. This is a real issue. Strings seem to not be able to be returned in y_master functions. There's also no need to tag ******, he checks the YSI github regularly.


Re: Y_master - detter - 28.08.2015

Thank you for your suggestion.