lua-users home
lua-l archive

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


Op Di., 28 Aug. 2018 om 20:44 het IllidanS4 <illidans4@gmail.com> geskryf:

> I find this occasion suitable for a new API function, lua_numresults, which shall return the number of expected return values. In this case, a non-zero check is all that is needed to optimize the function and prevent unneeded construction of objects.
...
> I find this solution better than passing another parameter to specify the number of results needed,
...
> lua_numresults ... can be implemented quite easily

My first reaction when I read the filrst quote is that the information
is available on the stack just before you issue lua_call,
and that passing the value as the first, not the last, parameter would
be very easy.

The I saw the second quote, which shows thw OP thought about that
solution and rejected it.

When I came to the third quote, I was baffled. Where do you plan to
store the required value if not on the stack?