[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Hooks for I/O, memory, etc?
- From: Björn De Meyer <bjorn.demeyer@...>
- Date: Wed, 12 Jun 2002 00:18:16 +0200
Björn De Meyer wrote:
> Roberto Ierusalimschy wrote:
> > The drawback is that everyone using Lua would have to start it with
> > something like
> > lua_open(&realloc);
> > which is not exactly friendly...
> Not really. Lua _open can do that behind our backs.
> You keep the "callback functions"/"hooks" stored as
> funcion pointers somewhere in the Lua state. By default,
> the state is set up by lua_open to use the default ANCI C
> functions. The callback can then be changed by a new LUA api
> call such has lua_set_callbacks(lua_state *,
> lua_callback_struct *);
> I can elaborate, and even suggest a patch, if you wish.
Well, I didn't notice the date on that posting,
and other people have suggested better solutions, so,
you'd best disregard this message. My preference would go
to keeping lua_open the way it is, and add a lua_opencallbacks
for customization of memory allocation and such.
"No one knows true heroes, for they speak not of their greatness." --
Björn De Meyer