int luaL_typerror (lua_State *L, int narg, const char *tname);

Generates an error with a message like the following:

     _location_: bad argument _narg_ to '_func_' (_tname_ expected, got _rt_)

where _location_ is produced by luaL_where, _func_ is the name of the current function, and _rt_ is the type name of the actual argument.