lua-users home
lua-l archive

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


> Callbacks for I/O and memory allocation seems, to me anyway, obvious 
> for an embedded API. Is there any drawback to it? Sure I have a       
> working implementation now, but I went through a                      

The drawback is that everyone using Lua would have to start it with
something like

  lua_open(&realloc);

which is not exactly friendly... Note that you already can change memory
allocation without editing the source:

  #ifndef l_realloc
  #define l_realloc(b,os,s)       realloc(b,s)
  #endif

(5.0w0 still uses an extra l_free; we are removing it.) So all you need
is to define your own "l_realloc" when compiling Lua.

-- Roberto