lua-users home
lua-l archive

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


> > lua_open. Much better in my opinion would be something like:
> >
> > lua_userealloc(&my_custom_realloc);
> >
> > called just before lua_open so that it can still use the defaults if the
> > user doesn't want to write their own.
>
> If we call it before lua_open, where would we store such value? (Lua
> uses no global/static variables. Everything in Lua is stored in a
> lua_State, which is created by lua_open.)

you could pass a pointer to a struct that holds the callback pointers to
lua_open (defaulting to NULL).

or make two versions of lua_open: one with no extra parameters, and one
which lets you specify all the hooks.

Cheers,
Peter