AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   The '...' operator (https://forums.alliedmods.net/showthread.php?t=28208)

Zenith77 05-09-2006 17:00

The '...' operator
 
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

Freecode 05-09-2006 19:08

vformat will be introduced in the next release.
for now use set,get,num -args

PM 05-10-2006 07:50

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 ^_^

Zenith77 05-10-2006 15:18

thanks a ton guys :)


All times are GMT -4. The time now is 05:02.

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