src/t.c
int t_typeerror( lua_State *L, int pos, const char *tname )
{
	const char *msg;
	const char *typearg;  /* name for the type of the actual argument */
	if (LUA_TSTRING == luaL_getmetafield( L, pos, "__name" ))
		typearg = lua_tostring(L, -1);  /* use the given type name */
	else if (LUA_TLIGHTUSERDATA == lua_type(L, pos))
		typearg = "light userdata";  /* special name for messages */
	else
		typearg = luaL_typename( L, pos );  /* standard name */
	msg = lua_pushfstring( L, "%s expected, got %s", tname, typearg );
	return luaL_argerror( L, pos, msg );
}
/** -------------------------------------------------------------------------
 * Type Error formatter, adapted from lauxlib.c
 * \param  L      Lua state.
 * \param  pos    int; position of wrong typed object on stack.
 * \param  tname  Name of expected type.
 * \return int    # of values pushed onto the stack.
 *-------------------------------------------------------------------------*/
Type Error formatter, adapted from lauxlib.c
\param  L      Lua state.
\param  pos    int; position of wrong typed object on stack.
\param  tname  Name of expected type.
\return int    # of values pushed onto the stack.
Type Error formatter adapted from lauxlib . c \ param L Lua state . \ param pos int ; position of wrong typed object on stack . \ param tname Name of expected type . \ return int # of values pushed onto the stack .
int t_typeerror( lua_State *L, int pos, const char *tname )
{
	const char *msg;
	const char *typearg;  
	if (LUA_TSTRING == luaL_getmetafield( L, pos, "__name" ))
		typearg = lua_tostring(L, -1);  
	else if (LUA_TLIGHTUSERDATA == lua_type(L, pos))
		typearg = "light userdata";  
	else
		typearg = luaL_typename( L, pos );  
	msg = lua_pushfstring( L, "%s expected, got %s", tname, typearg );
	return luaL_argerror( L, pos, msg );
}
int t_typeerror ( lua_State * L , int pos , const char * tname ) { const char * msg ; const char * typearg ; if ( LUA_TSTRING == luaL_getmetafield ( L , pos , " " ) ) typearg = lua_tostring ( L , -1 ) ; else if ( LUA_TLIGHTUSERDATA == lua_type ( L , pos ) ) typearg = " " ; else typearg = luaL_typename ( L , pos ) ; msg = lua_pushfstring ( L , " " , tname , typearg ) ; return luaL_argerror ( L , pos , msg ) ; }
Type Error formatter, adapted from lauxlib.c
 \param  L      Lua state.
Type Error formatter adapted from lauxlib . c \ param L Lua state .
/* name for the type of the actual argument */ /* use the given type name */ /* special name for messages */ /* standard name */