Getargcount

From Hercules Wiki
Revision as of 00:03, 12 February 2013 by Mysterious (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Syntax

  • getargcount()

Description

To be used inside functions/callsub labels, returns quantity of arguments provided

Examples

In callsub:

mapname,x,y,z<TAB>script<TAB>SampleCallSub<TAB>123,{
      mes "The number of arguments in the callsub is: "+callsub(SAMPLE_CS,1,2,3,4,5,6);
close;

SAMPLE_CS:
    return getargcount();
end;
}

//This should return the message:
//The number of arguments in the callfunc is 6 


In callfunc:

mapname,x,y,z<TAB>script<TAB>SampleCallSub<TAB>123,{
      mes "The number of arguments in the callfunc is: "+callfunc(SAMPLE_CS,1,2,3,4,5);
close;

}
function<TAB>script<TAB>funcName<TAB>{
     return getargcount();
}

//This should return the message:
//The number of arguments in the callfunc is 5