[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: lua 4.0 userdata bug?
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 29 Apr 2002 09:43:03 -0300
> I have noticed a bug in my Lua 4.0 interpreter. It seems to me that if I
> push a userdata/tag pair using lua_pushusertag(), and the void * I pass in
> is NULL, the value is mangled when I attempt to retrieve it.
Yes, this is a known bug :-(
> ts->u.d.value = (udata == NULL) ? uts+1 : udata;
> ts->u.d.value = (udata == NULL && s > 0) ? uts+1 : udata;
We sent a patch to the list, long time ago. You can search the archives...
As far as I remember, your solution is OK, but you can write simply
ts->u.d.value = (s > 0) ? uts+1 : udata;