src/t_buf_seg.c
static int
lt_buf_seg_next( lua_State *L )
{
	struct t_buf_seg *seg   = t_buf_seg_check_ud( L, 1, 1 );
	struct t_buf     *buf;

	lua_getiuservalue( L, 1, T_BUF_SEG_BUFIDX );            //S: seg buf
	buf = t_buf_check_ud( L, -1, 1 );
	lua_pop( L, 1 );
	if (seg->idx + seg->len > buf->len)
		lua_pushboolean( L, 0 );
	else
	{
		t_buf_seg_set( L, seg, buf,
			seg->idx + seg->len,
			(seg->idx + 2*seg->len > buf->len)
				? buf->len - seg->idx - seg->len + 1
				: seg->len
		);
		lua_pushboolean( L, 1 );
	}
	return 1;
}
/**--------------------------------------------------------------------------
 * next method for Buffer.Segment to shift along buffer.
 * \param   L      Lua state.
 * \lparam  ud     T.Buffer.Segement userdata instance.
 * \lreturn value  boolean if operation was successful.
 * \return  int    # of values pushed onto the stack.
 * --------------------------------------------------------------------------*/
next method for Buffer.Segment to shift along buffer.
\param   L      Lua state.
\lparam  ud     T.Buffer.Segement userdata instance.
\lreturn value  boolean if operation was successful.
\return  int    # of values pushed onto the stack.
next method for Buffer . Segment to shift along buffer . \ param L Lua state . \ lparam ud T . Buffer . Segement userdata instance . \ lreturn value boolean if operation was successful . \ return int # of values pushed onto the stack .
static int
lt_buf_seg_next( lua_State *L )
{
	struct t_buf_seg *seg   = t_buf_seg_check_ud( L, 1, 1 );
	struct t_buf     *buf;
	lua_getiuservalue( L, 1, T_BUF_SEG_BUFIDX );            
	buf = t_buf_check_ud( L, -1, 1 );
	lua_pop( L, 1 );
	if (seg->idx + seg->len > buf->len)
		lua_pushboolean( L, 0 );
	else
	{
		t_buf_seg_set( L, seg, buf,
			seg->idx + seg->len,
			(seg->idx + 2*seg->len > buf->len)
				? buf->len - seg->idx - seg->len + 1
				: seg->len
		);
		lua_pushboolean( L, 1 );
	}
	return 1;
}
static int lt_buf_seg_next ( lua_State * L ) { struct t_buf_seg * seg = t_buf_seg_check_ud ( L , 1 , 1 ) ; struct t_buf * buf ; lua_getiuservalue ( L , 1 , T_BUF_SEG_BUFIDX ) ; buf = t_buf_check_ud ( L , -1 , 1 ) ; lua_pop ( L , 1 ) ; if ( seg -> idx + seg -> len > buf -> len ) lua_pushboolean ( L , 0 ) ; else { t_buf_seg_set ( L , seg , buf , seg -> idx + seg -> len , ( seg -> idx + 2 * seg -> len > buf -> len ) ? buf -> len - seg -> idx - seg -> len + 1 : seg -> len ) ; lua_pushboolean ( L , 1 ) ; } return 1 ; }
next method for Buffer.Segment to shift along buffer.
next method for Buffer . Segment to shift along buffer .
//S: seg buf