lua-users home
lua-l archive

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


On Tue, 01 Sep 2009 17:20:48 +0300, Jerome Vuarand <jerome.vuarand@gmail.com> wrote:

When I first used userdata environment I assumed it was the case and
was quite disappointed to discover it's not.

However you have other methods to associate metadata to a userdata.
For example you can use a weak table in the registry, with the
userdata as a weak key and the string as value.

Thanks. This indeed is probably the best one can do now. But doing this
spoils the "convenience feature for programmers" part. And it is MUCH
slower than accessing value through a direct pointer.
Basically my question is whether any code other than the lua_setfenv and lua_getfenv depend on Udata->env being a (Table *)? If adding dozen lines to the core means I don't have to create extra table, and it doesn't break anything, I think it's worth doing.