lua-users home
lua-l archive

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


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 ?