lua-users home
lua-l archive

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


On Jan 6, 2010, at 9:03 AM, Roberto Ierusalimschy wrote:

>> Does that mean in 5.2, I can't have any per-thread data? It has to
>> be global to a Lua state or private to a function?
> 
> Note that in 5.1 the built-in per-thread data is not very useful, as you
> cannot access it from Lua. (That is the main reason why we are removing
> it).
> 
> In C, it is not difficult to use the thread itself as a key to store
> per-thread data in the registry, if necessary.

I could see an argument for still supporting C access to an environment table attached to a thread. As with the environment table attached to userdata, it wouldn't be particularly "environmental" but it eliminates one case where I would assume one would otherwise need a semi-weak table. I know 5.2 has the new marking logic for semi-weak tables, but I also know that logic is potentially expensive depending on the actual graph structure so it seems like a good idea to provide alternatives where feasible.

Mark