2,561
edits
mNo edit summary |
|||
Line 105: | Line 105: | ||
= Argument Processing = | = Argument Processing = | ||
Consider the callback signature: | |||
static naRef f_cool (naContext c, naRef me, int argc, naRef* args) | static naRef f_cool (naContext c, naRef me, int argc, naRef* args) | ||
The arguments to the function are passed in in the args array. The number of arguments is passed via the argc parameter (this is basically consistent with the standard signature of main in C/C++). | The arguments to the function are passed in in the args array. The number of arguments is passed via the argc parameter (this is basically consistent with the standard signature of main in C/C++). | ||
So, if you know that you require a certain number of arguments, you can also directly check argc | So, if you know that you require a certain number of arguments, you can also directly check argc to to match your requirements and show an error message, return nil, or throw an exception using naRuntimeError(): | ||
// Throw an error from the current call stack. This function makes a | // Throw an error from the current call stack. This function makes a |
edits