util-src/ringbuffer.c
/*
 * Read buffer until first occurrence of a substring
 * (buffer, string) -> string
 */
Read buffer until first occurrence of a substring
(buffer, string) -> string
Read buffer until first occurrence of a substring ( buffer string ) - > string
int rb_readuntil(lua_State *L) {
	size_t l, m;
	ringbuffer *b = luaL_checkudata(L, 1, "ringbuffer_mt");
	const char *s = luaL_checklstring(L, 2, &l);
	m = find(b, s, l);
	if(m > 0) {
		lua_settop(L, 1);
		lua_pushinteger(L, m);
		return rb_read(L);
	}
	return 0;
}
int rb_readuntil ( lua_State * L ) { size_t l , m ; ringbuffer * b = luaL_checkudata ( L , 1 , " " ) ; const char * s = luaL_checklstring ( L , 2 , & l ) ; m = find ( b , s , l ) ; if ( m > 0 ) { lua_settop ( L , 1 ) ; lua_pushinteger ( L , m ) ; return rb_read ( L ) ; } return 0 ; }
Read buffer until first occurrence of a substring
 (buffer, string) -> string
Read buffer until first occurrence of a substring ( buffer string ) - > string