WSGetArgCount (C Function)

int WSGetArgCount(WSLINK link,int *n)

finds the number of arguments to a function on link and stores the result in n.

Details

  • WSGetArgCount() is declared in the WSTP header file wstp.h.

Examples

Basic Examples  (1)

#include "wstp.h"

/* check a link for a function and return the number of arguments */

int f(WSLINK lp)
{
    int a;

    switch(WSGetType(lp))
    {
        case WSTKFUNC:
            /* get the argument size */
            if(! WSGetArgCount(lp, &a))
                { /* unable to get the number of arguments from lp */ }
            return a;
        default:
            /* ... */
    }

    /* ... */
}