src/t_csv_l.c
static int
lt_csv_ParseLine( lua_State *L )
{
	//S: dlm qte esc dbl lne tbl cnt
	const char   dlm = luaL_checkstring( L, 1 )[ 0 ];
	const char   qte = luaL_checkstring( L, 2 )[ 0 ];
	const char   esc = luaL_checkstring( L, 3 )[ 0 ];
	const int    dbl = lua_toboolean( L, 4 );
	const char  *lne = luaL_checkstring( L, 5 );
	luaL_argcheck( L, (LUA_TTABLE == lua_type( L, 6 )), 6, "Expected a Table" );

	struct t_csv_row row = {
		.ste = T_CSV_FLDBEG,
		.dlm = dlm,
		.qte = qte,
		.esc = esc,
		.dbl = dbl,
		.run = lne,
		.beg = lne,
		.len = 0,
		.fld = lne,
		.hdb = 0,
		.hec = 0,
		.cnt = luaL_optinteger( L, 7, 0 ),
		.ssq = { qte, 0 },
		.sdq = { qte, qte, 0 },
		.sec = { esc, 0 },
	};
	lua_pop( L, 1 );               // pop the field count
	t_csv_parse( L, &row );
	lua_pushboolean( L, T_CSV_RECDNE == row.ste );
	lua_pushstring( L, row.fld );
	lua_pushinteger( L, row.cnt );
	return 3;
}
/**--------------------------------------------------------------------------
 * Attempts to read a single line of CSV content
 * \param   L       Lua state.
 * \lparam  string  string containing delimiter character.
 * \lparam  string  string containing quotation character.
 * \lparam  string  string containing escape character.
 * \lparam  bool    is this parsing using double quotation characters?
 * \lparam  string  Single row of CSV content.
 * \lparam  table   Table to push the results into.
 * \lparam  int     Index from where to start pushing fields into.
 * \lreturn boolean Was it complete? False mean more lines are needed.
 * \lreturn string  String starting at the beginning of last processed field.
 * \lreturn int     Number of fields parsed in this function call.
 * \return  int     # of values pushed onto the stack.
 * --------------------------------------------------------------------------*/
Attempts to read a single line of CSV content
\param   L       Lua state.
\lparam  string  string containing delimiter character.
\lparam  string  string containing quotation character.
\lparam  string  string containing escape character.
\lparam  bool    is this parsing using double quotation characters.
\lparam  string  Single row of CSV content.
\lparam  table   Table to push the results into.
\lparam  int     Index from where to start pushing fields into.
\lreturn boolean Was it complete. False mean more lines are needed.
\lreturn string  String starting at the beginning of last processed field.
\lreturn int     Number of fields parsed in this function call.
\return  int     # of values pushed onto the stack.
Attempts to read a single line of CSV content \ param L Lua state . \ lparam string string containing delimiter character . \ lparam string string containing quotation character . \ lparam string string containing escape character . \ lparam bool is this parsing using double quotation characters . \ lparam string Single row of CSV content . \ lparam table Table to push the results into . \ lparam int Index from where to start pushing fields into . \ lreturn boolean Was it complete . False mean more lines are needed . \ lreturn string String starting at the beginning of last processed field . \ lreturn int Number of fields parsed in this function call . \ return int # of values pushed onto the stack .
static int
lt_csv_ParseLine( lua_State *L )
{
	const char   dlm = luaL_checkstring( L, 1 )[ 0 ];
	const char   qte = luaL_checkstring( L, 2 )[ 0 ];
	const char   esc = luaL_checkstring( L, 3 )[ 0 ];
	const int    dbl = lua_toboolean( L, 4 );
	const char  *lne = luaL_checkstring( L, 5 );
	luaL_argcheck( L, (LUA_TTABLE == lua_type( L, 6 )), 6, "Expected a Table" );
	struct t_csv_row row = {
		.ste = T_CSV_FLDBEG,
		.dlm = dlm,
		.qte = qte,
		.esc = esc,
		.dbl = dbl,
		.run = lne,
		.beg = lne,
		.len = 0,
		.fld = lne,
		.hdb = 0,
		.hec = 0,
		.cnt = luaL_optinteger( L, 7, 0 ),
		.ssq = { qte, 0 },
		.sdq = { qte, qte, 0 },
		.sec = { esc, 0 },
	};
	lua_pop( L, 1 );               
	t_csv_parse( L, &row );
	lua_pushboolean( L, T_CSV_RECDNE == row.ste );
	lua_pushstring( L, row.fld );
	lua_pushinteger( L, row.cnt );
	return 3;
}
static int lt_csv_ParseLine ( lua_State * L ) { const char dlm = luaL_checkstring ( L , 1 ) [ 0 ] ; const char qte = luaL_checkstring ( L , 2 ) [ 0 ] ; const char esc = luaL_checkstring ( L , 3 ) [ 0 ] ; const int dbl = lua_toboolean ( L , 4 ) ; const char * lne = luaL_checkstring ( L , 5 ) ; luaL_argcheck ( L , ( LUA_TTABLE == lua_type ( L , 6 ) ) , 6 , " " ) ; struct t_csv_row row = { . ste = T_CSV_FLDBEG , . dlm = dlm , . qte = qte , . esc = esc , . dbl = dbl , . run = lne , . beg = lne , . len = 0 , . fld = lne , . hdb = 0 , . hec = 0 , . cnt = luaL_optinteger ( L , 7 , 0 ) , . ssq = { qte , 0 } , . sdq = { qte , qte , 0 } , . sec = { esc , 0 } , } ; lua_pop ( L , 1 ) ; t_csv_parse ( L , & row ) ; lua_pushboolean ( L , T_CSV_RECDNE == row . ste ) ; lua_pushstring ( L , row . fld ) ; lua_pushinteger ( L , row . cnt ) ; return 3 ; }
Attempts to read a single line of CSV content
 \param   L       Lua state.
Attempts to read a single line of CSV content \ param L Lua state .
//S: dlm qte esc dbl lne tbl cnt // pop the field count