[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Is it normal that luaL_checkudata() makes my program to dye
- From: Peter Cawley <lua@...>
- Date: Tue, 1 May 2018 22:49:41 +0100
PiL on the web refers to Lua 5.0, where the behaviour was different.
Compare https://github.com/lua/lua/blob/v5_0/lauxlib.c#L132 to
https://github.com/lua/lua/blob/v5_1/lauxlib.c#L124
On Tue, May 1, 2018 at 10:36 PM, Laurent FAILLIE <l_faillie@yahoo.com> wrote:
> Hello,
>
> Reading example in https://www.lua.org/pil/28.2.html, I guessed that
> luaL_checkudata() only return a NULL pointer if the argument doesn't match
> an user data of the given type.
> But unfortunately, it raise a fatal error :
>
> My code is
>
> ...
> } else if( (r = luaL_checkudata(L, -1, "SelSharedFunc")) )
> func = *r;
>
> puts("bla bla"); ...
>
> but puts() is never reached if the argument is not matching and raise
> following error :
>
> Selenites/MQTT.sel:53: bad argument #-2 to 'Subscribe' (SelSharedFunc
> expected, got nil)
>
> Did I misunderstood the documentation or there is another problem ?
>
> Thanks
>
> Laurent
>