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

Re: Passing Variadic Function Parameters to Another Variadic Function?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
WISHEXEC
Junior Member
Join Date: Aug 2015
Location: Romania
Old 05-13-2020 , 17:30   Re: Passing Variadic Function Parameters to Another Variadic Function?
Reply With Quote #1

How to format a function signature ?

Code:
parse(iLine, Arg1, 31, Arg2, 31, Arg3, 31, Arg4, 31, Arg5, 31, Arg6, 31)
->

Code:
new UNIQUE[] =  "iLine, Arg1, 31, Arg2, 31, Arg3, 31, Arg4, 31, Arg5, 31, Arg6, 31" 

parse(UNIQUE)
any ideeas ?

thanks

Last edited by WISHEXEC; 05-13-2020 at 17:44.
WISHEXEC is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 05-13-2020 , 19:16   Re: Passing Variadic Function Parameters to Another Variadic Function?
Reply With Quote #2

Same topic, same title, same solution: https://forums.alliedmods.net/showthread.php?t=191384

Quote:
Originally Posted by asherkin View Post
You just want to use VFormat.
__________________
Psyk0tik is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 05-13-2020 , 19:24   Re: Passing Variadic Function Parameters to Another Variadic Function?
Reply With Quote #3

Quote:
Originally Posted by Crasher_3637 View Post
Same topic, same title, same solution: https://forums.alliedmods.net/showthread.php?t=191384
Might wanna re-read the question.
__________________
asherkin is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 05-13-2020 , 20:05   Re: Passing Variadic Function Parameters to Another Variadic Function?
Reply With Quote #4

Quote:
Originally Posted by asherkin View Post
Might wanna re-read the question.
Ah, my bad. Based on the code he provided, it seemed like he was asking how to pass a string of arguments to a function, which I interpreted as him wanting to send a dynamic number of arguments like VFormat allows.
__________________
Psyk0tik is offline
WISHEXEC
Junior Member
Join Date: Aug 2015
Location: Romania
Old 05-14-2020 , 09:07   Re: Passing Variadic Function Parameters to Another Variadic Function?
Reply With Quote #5

actually Crasher is right something like that i want to achieve

vformat(buffer[], len, const fmt[], vararg) ...

Code:
parse(iLine, Arg1, 31, Arg2, 31, Arg3, 31, Arg4, 31, Arg5, 31, Arg6, 31)
So vformat looks like this ?

Code:
new varargs[][];  
 
vformat(buffer[], 1023, varargs[][], 31 ... ) 

parse(iLine, buffer[])

Last edited by WISHEXEC; 05-14-2020 at 09:10.
WISHEXEC is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 05-14-2020 , 09:52   Re: Passing Variadic Function Parameters to Another Variadic Function?
Reply With Quote #6

Quote:
Originally Posted by WISHEXEC View Post
actually Crasher is right something like that i want to achieve

vformat(buffer[], len, const fmt[], vararg) ...

Code:
parse(iLine, Arg1, 31, Arg2, 31, Arg3, 31, Arg4, 31, Arg5, 31, Arg6, 31)
So vformat looks like this ?

Code:
new varargs[][];  
 
vformat(buffer[], 1023, varargs[][], 31 ... ) 

parse(iLine, buffer[])
PHP Code:
MyFunction("%i %i %i %i"31313131); // string must contain format specifiers that will be replaced by the args you pass to the function

void MyFunction(char[] bufferany ...) // the "..." is the 2nd parameter
{
    
char sNumList[32];
    
VFormat(sNumListsizeof sNumListbuffer2); // the "..." is the 2nd parameter
    
PrintToServer("%s"sNumList);

__________________
Psyk0tik is offline
WISHEXEC
Junior Member
Join Date: Aug 2015
Location: Romania
Old 05-14-2020 , 10:38   Re: Passing Variadic Function Parameters to Another Variadic Function?
Reply With Quote #7

ok .. i think i understand

thank you for your time !
WISHEXEC 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 10:16.


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