lua-users home
lua-l archive

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


>I guess the "light-weight" userdata is to ease the burden on Lua's
>internals whenever necessasry, i.e., no meta table bookkeeping
>stuff.

Right. But that was a request by the community: many people want simply to
store C pointers in Lua with as little overhead as possible to retrieve them
later. These C pointers point to areas that are managed by the application abd
they don't care whether there are references to it in Lua or not (and so need
not be told about GC for them).

>However, my biggest complaint of lua5 is now there seems no way to
>define a "heavy-weight" userdata without using Lua's memory allocation
>method.

By definition, that's what "heavy-weight" userdata is. Or is your complaint
about the use of Lua's memory allocation? You can always compile Lua to use
your own memory allocation method.

>I can no longer define a GC method for pure C pointers. 

You can "box" them inside a heavy userdata. C pointers that do not need GC
methods can be stored in light userdata.

For discussions of heavy x light userdata, search the lua-l archives for
lua_newuserdata. For instance:
   http://lua-users.org/lists/lua-l/2002-11/msg00062.html
   http://lua-users.org/lists/lua-l/2002-08/msg00162.html

>When it occurred to me almost impossible to convert my program to
>Lua5, I'd still stick with Lua4 for now.

Why impossible? The move to Lua 5 is meant to gain more users not lose them! :-(
Please, tell us how we can help.

It worries me that some people seem to have a negative impression of Lua 5
so near to it being officially released. Someone even said that we have
"seriously damaged Lua functionality"! Sure, Lua 5 is different from Lua 4.
The metamethod scheme is not the same as the tagmethod scheme, but it is
simpler and more flexible, even if sometimes you have to use proxy tables
for doing some stuff that was easy in Lua 4. Lua 5 was the outcome of a long
sequence of work versions of Lua 4.1 and has gone through alpha and now beta
stages. I'd think major design flaws would be found by now :-(
--lhf