lua-users home
lua-l archive

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


> 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;
         x
>  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;

-- Roberto