[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua_pushlightuserdata fed with NULL pointer
- From: Peter Cawley <lua@...>
- Date: Sun, 24 Oct 2010 13:34:00 +0100
On Sun, Oct 24, 2010 at 1:27 PM, Shmuel Zeigerman <shmuz@013net.net> wrote:
> 1. lua_pushstring(L, NULL) is equivalent to lua_pushnil(L).
> 2. lua_pushlightuserdata(L, NULL) pushes light userdata with null value.
>
> I would suggest (for Lua 5.2) making case 2 above to behave as case 1, since
> there is no (easy) way to find out from Lua script if it was the null
> pointer.
I am not a fan of the proposed behaviour. NULL as a char* generally
means "no string", the nearest representation of which is nil. NULL as
a void* has a wider meaning, and already has a representation as a
light-userdata with no loss of information.