lua-users home
lua-l archive

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


> 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