[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua C API
- From: Jim <djvaios@...>
- Date: Wed, 22 May 2019 23:20:30 +0200
On 5/22/19, Sean Conner <sean@conman.org> wrote:
> The return value for a lua_CFunction is the number of returned
> values---negative values are undefined behavior. For example, when I call
> the following function:
>
> int badret(lua_State *L)
> {
> return -lua_gettop(L);
> }
>
> I get:
>
> > badret(1)
> Segmentation fault (core dumped)
>
> Your results may vary.
ok, i see.
maybe specifying unsigned int as return/result type could fix this
(unsigned int cfunc ( lua_State * L )) easily ?