Raised This Month: $32 Target: $400
 8% 

Why isn't "parsetok" a thing yet?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 12-26-2019 , 20:28   Why isn't "parsetok" a thing yet?
Reply With Quote #1

https://forums.alliedmods.net/showpo...69&postcount=5

This is actually quite a useful stock that should definitely be integrated into the next AMXX build. Basically, "parsetok" is the same thing as "parse" which lets you store each piece in any amount of character arrays you please, except, unlike the "parse", it tokenizes with any character you input instead of just whitespace.

I won't make it myself, yet, but I'd also recommend to have a second version of the stock, as well; Which uses a string instead of a single character as a token.

i.e
parsetokc = Character token
parsetoks = String token
redivcram is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-27-2019 , 10:02   Re: Why isn't "parsetok" a thing yet?
Reply With Quote #2

I'm not saying it's ideal, but you could replace your delimited with space and then use parse. If your message already has spaces then replace them too with another symbol, then after parse convert back.
__________________
HamletEagle is offline
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 12-27-2019 , 11:30   Re: Why isn't "parsetok" a thing yet?
Reply With Quote #3

Quote:
Originally Posted by HamletEagle View Post
I'm not saying it's ideal, but you could replace your delimited with space and then use parse. If your message already has spaces then replace them too with another symbol, then after parse convert back.
There are many ways to do it, yes, but this is as optimal as it gets as you call one stock.

Last edited by redivcram; 12-27-2019 at 11:30.
redivcram is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-27-2019 , 13:21   Re: Why isn't "parsetok" a thing yet?
Reply With Quote #4

Off-topic: I wish people would stop putting the equal sign between efficiency and number of function calls. What matters is what each function does, not how many functions are called.
__________________
HamletEagle is offline
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 12-27-2019 , 14:45   Re: Why isn't "parsetok" a thing yet?
Reply With Quote #5

Okay. lol
redivcram is offline
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 12-27-2019 , 15:00   Re: Why isn't "parsetok" a thing yet?
Reply With Quote #6

Dang, I can't find the two natives, hence by native, I believe they are hardcoded into metamod?
redivcram is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 12-27-2019 , 18:44   Re: Why isn't "parsetok" a thing yet?
Reply With Quote #7

Quote:
Originally Posted by redivcram View Post
Dang, I can't find the two natives, hence by native, I believe they are hardcoded into metamod?
A native do not always mean performance gain (Even if insignificant in this case).

Is not better add on string_stocks?
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 12-27-2019 , 19:55   Re: Why isn't "parsetok" a thing yet?
Reply With Quote #8

Quote:
Originally Posted by ^SmileY View Post
A native do not always mean performance gain (Even if insignificant in this case).

Is not better add on string_stocks?
I was talking about "replace" and "parse" natives' whereabouts. I can only find their native declaration.

Last edited by redivcram; 12-27-2019 at 19:55.
redivcram is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-27-2019 , 20:39   Re: Why isn't "parsetok" a thing yet?
Reply With Quote #9

Quote:
Originally Posted by redivcram View Post
I was talking about "replace" and "parse" natives' whereabouts. I can only find their native declaration.
parse() (source code)
replace() (source code)
__________________

Last edited by fysiks; 12-27-2019 at 20:46.
fysiks is offline
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 01-06-2020 , 17:03   Re: Why isn't "parsetok" a thing yet?
Reply With Quote #10

Woah, thanks fysiks.
redivcram 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 15:50.


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