lua-users home
lua-l archive

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

On Mon, Mar 1, 2010 at 8:01 AM, Juris Kalnins <> wrote:
>> (So, the
>> only "environments" left are for userdata, which probably should
>> get a more proper name.)
> I'd like to ask if you could consider making it possible to have
> Lua values associated with userdata (specified at the creation time),
> insetad of the fixed 1.
> It wouldn't complicate core much, but could really help in the cases where
> one
> has to associate more than one value with userdata.

I'm not against the idea, but I'm a bit confused why it'd be better
than just using an array as the 1 value? If you specify the number of
values you're going to use with the array size parameter of
lua_createtable(), then use lua_rawgeti() and lua_rawseti() to get/set
the values, that should make it pretty fast. You do have to go through
the extra step of retrieving the array before getting at the values,
but you could always write helper functions/macros to help with that
if it really bothers you.