[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Number of results returned by lua_pcall?
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 28 Jul 2011 09:07:15 -0300
> Since I don't know how many return values 'y' is returning I'm using
> LUA_MULTRET in lua_pcall, like so:
[...]
> Otherwise I wish to return the same number of results as 'y', but, how
> do I know how many return values lua_pcall is returning?
Call lua_gettop before setting up the call (ie, before pushing the function
and its arguments). Call lua_gettop again after the call. The difference is
the number of values returned by the function.