[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Hooks for I/O, memory, etc?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Tue, 11 Jun 2002 08:43:58 -0300
> You wouldn't necessarily have to integrate the callback mechanism with
> 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.)
On the other hand, it can't be called after lua_open, because lua_open
itself needs that function to allocate several memory blocks.
-- Roberto