luaL_argerror

int luaL_argerror (lua_State *L, int numarg, const char *extramsg);

Raises an error with the following message, where func is retrieved from the call stack:

     bad argument #<numarg> to <func> (<extramsg>)

This function never returns, but it is an idiom to use it in C functions as return luaL_argerror(args).