Raised This Month: $ Target: $400
 0% 

The '...' operator


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zenith77
Veteran Member
Join Date: Aug 2005
Old 05-09-2006 , 17:00   The '...' operator
Reply With Quote #1

Ok lets say we have a function

Code:
public OmgAFunction(str[], ...) { //some code here return PLUGIN_HANDLED }

I want to know how to access the extra parameters passed in the '...' part, not sure if I worded that right.


Thanks for any help!

gaben
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 05-09-2006 , 19:08  
Reply With Quote #2

vformat will be introduced in the next release.
for now use set,get,num -args
Freecode is offline
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 05-10-2006 , 07:50  
Reply With Quote #3

Depends on what you want to do. To simply access an argument: getarg()

Example from the small docs:
Code:
sum(...) {    new result = 0    for (new i = 0; i < numargs(); ++i)        result += getarg(i)    return result }

sum(1,5,6) should return 12.

edit: I guess this is what Freecode meant, but I didn't get it so I posted again ^_^
__________________
hello, i am pm
PM is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 05-10-2006 , 15:18  
Reply With Quote #4

thanks a ton guys
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 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 05:02.


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