[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Small question about os.exit and __gc
- From: Coroutines <coroutines@...>
- Date: Fri, 14 Mar 2014 11:59:03 -0700
On Fri, Mar 14, 2014 at 11:39 AM, Roberto Ierusalimschy
>> I think I was one of the group asking for os.exit() to accept a
>> boolean in 5.2 so it feels like it changed a lot to me (hah). I
>> frequently wrapped that, along with table.concat() to do a tostring()
>> on its elements. 5.2 brought many welcome changes -- I still wish you
>> could associate userdata-to-userdata with set/getuservalue(), though
> We will get that in 5.3.
Just for clarification -- associating userdata-to-userdata will be in
5.3? If you remember correctly I posted a while ago about wanting to
allocate 2 chunks of memory (userdata) to be managed by Lua's garbage
collector, but I only wanted 1 of the userdata to be visible. I
couldn't allocate the 2 chunks of memory together as 1 userdata
because it would show the total size with lua_objlen/rawlen(). I
wanted to use setuservalue() to make sure they were collected together
when the visible userdata becomes unreferenced. I think it was you
that gave me a great solution of using a shared table associated with
the visible userdatas and storing the invisible/private userdatas as
weak values with the visible userdata as the key in that shared table.
That definitely works for what I wanted, but it is not as direct as I
would have liked when retrieving the private userdata from C, and
could be costly in a tight loop. :> Is this dream of mine in 5.3?
(Sorry for hijacking the subject of this thread but as long as I have
>> Coroutines isn't my name, no. I was going by Sir Pogsalot
>> (email@example.com) and I also go by Sleepy_Coder on #lua on
>> Freenode. :> Frequently making an embarrassing spectacle of myself,
>> sometimes I have a good problem to ask lua-l though. :-) Why?
> Maybe it is just because I am old, but I like to know the real name of
> someone whom I am talking to (unless there is a good reason otherwise).
> -- Roberto
Hmm. I'm not ready to associate my name with this identity. Looking
for work and I'm not yet sure which online identity I want to use for
that. I would otherwise love to be on a first-name basis with a
clever guy like you :-)