src/t.c
int
t_push_error( lua_State *L, int fail, int ops, const char *fmt, ... )
{
	va_list argp;
	if (fail)
		luaL_where( L, 1 );
	else
	{
		if (ops)    // semantically an operation failed
			lua_pushboolean( L, 0==1 );
		else        // semantically the creation of a resource failed
			lua_pushnil( L );
	}
	if (NULL == fmt)
		lua_pushstring( L, (errno) ? "" : "Unknown Error" );
	else
	{
		va_start( argp, fmt );
		lua_pushvfstring( L, fmt, argp );
		va_end( argp );
	}
	if (errno) lua_pushfstring( L, " (%s)", strerror( errno ));
	lua_concat( L, (fail && errno) ? 3 : (fail || errno) ? 2 : 1 );
	return ((fail) ? lua_error( L ) : 2);
}
/** -------------------------------------------------------------------------
 * Returns an error string to the Lua script.
 * Expands luaL_error by errno support which is useful when system functions
 * are called, eg. surrounding network functionality and others.
 * \param  L     The Lua intepretter object.
 * \param  fail  bool. Raise LuaError.
 * \param  ops   bool. Operation failed -> return false; else resource failed -> * return nil.
 * \param  fmt   Error string.
 * \param  ...   variable arguments to fmt
 * \return int   # of values pushed onto the stack.
 *-------------------------------------------------------------------------*/
Returns an error string to the Lua script.
Expands luaL_error by errno support which is useful when system functions
are called, eg. surrounding network functionality and others.
\param  L     The Lua intepretter object.
\param  fail  bool.
Returns an error string to the Lua script . Expands luaL_error by errno support which is useful when system functions are called eg . surrounding network functionality and others . \ param L The Lua intepretter object . \ param fail bool .
int
t_push_error( lua_State *L, int fail, int ops, const char *fmt, ... )
{
	va_list argp;
	if (fail)
		luaL_where( L, 1 );
	else
	{
		if (ops)    
			lua_pushboolean( L, 0==1 );
		else        
			lua_pushnil( L );
	}
	if (NULL == fmt)
		lua_pushstring( L, (errno) ? "" : "Unknown Error" );
	else
	{
		va_start( argp, fmt );
		lua_pushvfstring( L, fmt, argp );
		va_end( argp );
	}
	if (errno) lua_pushfstring( L, " (%s)", strerror( errno ));
	lua_concat( L, (fail && errno) ? 3 : (fail || errno) ? 2 : 1 );
	return ((fail) ? lua_error( L ) : 2);
}
int t_push_error ( lua_State * L , int fail , int ops , const char * fmt , ... ) { va_list argp ; if ( fail ) luaL_where ( L , 1 ) ; else { if ( ops ) lua_pushboolean ( L , 0 == 1 ) ; else lua_pushnil ( L ) ; } if ( NULL == fmt ) lua_pushstring ( L , ( errno ) ? " " : " " ) ; else { va_start ( argp , fmt ) ; lua_pushvfstring ( L , fmt , argp ) ; va_end ( argp ) ; } if ( errno ) lua_pushfstring ( L , " " , strerror ( errno ) ) ; lua_concat ( L , ( fail && errno ) ? 3 : ( fail || errno ) ? 2 : 1 ) ; return ( ( fail ) ? lua_error ( L ) : 2 ) ; }
Returns an error string to the Lua script.
Returns an error string to the Lua script .
// semantically an operation failed // semantically the creation of a resource failed