[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: RE: UserData.
- From: "Andrew Paton" <andrew@...>
- Date: Wed, 31 Jan 2001 08:51:59 -0500
Thanks this is the exact line of code and how we wanted to change it but we
weren't sure about the effects. For now this works.
From: email@example.com [mailto:firstname.lastname@example.org]
On Behalf Of Roberto Ierusalimschy
Sent: Wednesday, January 31, 2001 6:42 AM
To: Multiple recipients of list
Subject: Re: UserData.
> I'm having trouble assigning NULL values to userdata items...
This is a bug in Lua 4.0; it was already reported by ET:
> Message-ID: <3A40E68E.48EF1F9D@gmx.de>
> Date: Wed, 20 Dec 2000 18:04:14 +0100
> From: Edgar Toernig <email@example.com>
> PS: Btw, lua_newuserdata and co are IMHO slightly broken:
> > print(dostring"") -- gives lua_pusheruserdata(L, NULL)
> userdata(0): 0x80632b0
> > print(dostring"")
> userdata(0): 0x8063448 -- and another one?!?
> Maybe this change
> - ts->u.d.value = (udata == NULL) ? uts+1 : udata;
> + ts->u.d.value = s ? uts+1 : udata;
> would make a little bit more sense. (There are other
> problems too. Still thinking about a solution.)
(The change is in lstring.c:122)
I think his fix will solve the problem, although I don't know what
would be the "other problems". (lua_newuserdata will return NULL if you
ask for zero bytes, but that is OK.)