[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: A suggestion to allow return count optimization (mostly for the C API)
- From: Dirk Laurie <dirk.laurie@...>
- Date: Wed, 29 Aug 2018 11:37:53 +0200
Op Di., 28 Aug. 2018 om 20:44 het IllidanS4 <email@example.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?