lua-users home
lua-l archive

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


> 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.