lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 5/16/19, Sean Conner <sean@conman.org> wrote:
>> I still fail to wee why you need LUA_BUFFERSIZE. Why not BUFSIZ?
>  1) Why have LUA_BUFFERSIZE when BUFSIZ exists?
>  2) I still need to use C to know what the value is.  It seems like
> overkill, and Lua already wraps several standard C functions,
> so why not a constant ?

maybe he is reluctant to add it since it would not be a constant
from the Lua side ?

just add and export a C function along this lines to your package:

static int get_bufsiz ( lua_State * const L )
{
  lua_pushinteger ( L,
    // without checking the macro's value :-/
#if defined (BUFSIZ)
    BUFSIZ
#else
    0 // maybe no good idea ?
#endif
    ) ;

  return 1 ;
}