lua-users home
lua-l archive

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


> Also, for the record, I don't have a problem with varargs in 
> lua_open().  But I think it looks gross to most C++ 
> programmers, which might explain the negative reactions.

A structure of pointers solves nearly all the problems.  And backwards
compatibility can be maintained trivially with 

Another option is a key/value pair system with a sentinel tag (Apple's
OpenGL implementation does this for pixel format description).  This is
a bit uglier IMO, but it generalizes better.

struct lua_callback
{
   lua_callback_t cb;
   int descriptor;
};

lua_callback aCallbacks[] =
{
   { myRealloc, LUA_REALLOC_CB },
   { 0, 0 }
};

lua_open( aCallbacks );

or, alternatively, ditch the sentinel and do:

lua_open( aCallbacks, sizeof( aCallbacks ) );

Point being that almost any of the solutions presented are better than
what we have right now. =)

Brian