[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: a new proposal for environments
- From: Duncan Cross <duncan.cross@...>
- Date: Mon, 1 Mar 2010 12:31:21 +0000
On Mon, Mar 1, 2010 at 8:01 AM, Juris Kalnins <juris@mt.lv> 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
> 0..MAXSOMETHING
> 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.
-Duncan