Raised This Month: $7 Target: $400
 1% 

Natives can return arrays in PAWN!


Post New Thread Reply   
 
Thread Tools Display Modes
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-09-2019 , 09:13   Re: Natives can return arrays in PAWN!
Reply With Quote #11

Quote:
Originally Posted by thEsp View Post
For example *_to_str natives SHOULD return array/string instead. Sure it might be "limited" (if that's the right term) but still there would be no need to declare a string and use them (which is a bit annoying).

Seems to be more efficient, right?
You still need to "declare a string to use them", otherwise where would the result go?
Also, why do you talk about efficiency here? It's unrelated.
__________________
HamletEagle is offline
thEsp
BANNED
Join Date: Aug 2017
Old 08-09-2019 , 09:41   Re: Natives can return arrays in PAWN!
Reply With Quote #12

Quote:
Originally Posted by HamletEagle View Post
You still need to "declare a string to use them", otherwise where would the result go?
That might be true but it depends on what user needs. If natives I referred to work that way, you can still store or occasionally use them directly.

Quote:
Originally Posted by Mistrick View Post
I think he told about some use cases like we need to create temp variable instead paste function as argument another function.
Totally correct.

Last edited by thEsp; 08-09-2019 at 09:44.
thEsp is offline
Mistrick
Senior Member
Join Date: Aug 2012
Location: Russia
Old 08-09-2019 , 09:42   Re: Natives can return arrays in PAWN!
Reply With Quote #13

Quote:
Originally Posted by HamletEagle View Post
You still need to "declare a string to use them", otherwise where would the result go?
I think he told about some use cases like we need to create temp variable instead paste function as argument another function.

PHP Code:
new num[6];
num_to_str(1numcharsmax(num));
menu_additem(menu"First"num);

menu_additem(menu"Second"num_to_str2(2)); 
Mistrick is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-09-2019 , 10:09   Re: Natives can return arrays in PAWN!
Reply With Quote #14

Fair enough, I only took into account the example that Klippy provided.
__________________
HamletEagle is offline
Pawn_Basic
New Member
Join Date: Jun 2014
Old 04-22-2020 , 14:29   Re: Natives can return arrays in PAWN!
Reply With Quote #15

what is this get_player_name function?
how did you compile it?
Pawn_Basic is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 04-26-2020 , 12:54   Re: Natives can return arrays in PAWN!
Reply With Quote #16

Quote:
Originally Posted by Pawn_Basic View Post
what is this get_player_name function?
how did you compile it?
You can find it in the attached archive. It's just a bare bones module used for the proof of concept. It's not meant to be used in production.
__________________

Last edited by klippy; 04-26-2020 at 12:55.
klippy is offline
Reply


Thread Tools
Display Modes

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 03:22.


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