diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-07-18 14:44:40 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2024-07-18 14:44:40 -0300 |
commit | a546138d158d79d44b2c5b42630be00d306f4e7c (patch) | |
tree | 8d2410921dc1af4dc8e7d19b21d3f313bcc812b4 /manual | |
parent | cd4de92762434e6ed0e6c207d56d365300396dd8 (diff) | |
download | lua-a546138d158d79d44b2c5b42630be00d306f4e7c.tar.gz lua-a546138d158d79d44b2c5b42630be00d306f4e7c.tar.bz2 lua-a546138d158d79d44b2c5b42630be00d306f4e7c.zip |
Explicit limit for number of results in a call
The parameter 'nresults' in 'lua_call' and similar functions has a
limit of 250. It already had an undocumented (and unchecked) limit of
SHRT_MAX, but it is seldom larger than 2.
Diffstat (limited to 'manual')
-rw-r--r-- | manual/manual.of | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/manual/manual.of b/manual/manual.of index 1069f644..c7f6904a 100644 --- a/manual/manual.of +++ b/manual/manual.of | |||
@@ -3028,14 +3028,20 @@ When the function returns, | |||
3028 | all arguments and the function value are popped | 3028 | all arguments and the function value are popped |
3029 | and the call results are pushed onto the stack. | 3029 | and the call results are pushed onto the stack. |
3030 | The number of results is adjusted to @id{nresults}, | 3030 | The number of results is adjusted to @id{nresults}, |
3031 | unless @id{nresults} is @defid{LUA_MULTRET}. | 3031 | unless @id{nresults} is @defid{LUA_MULTRET}, |
3032 | In this case, all results from the function are pushed; | 3032 | which makes all results from the function to be pushed. |
3033 | In the first case, an explicit number of results, | ||
3034 | the caller must ensure that the stack has space for the | ||
3035 | returned values. | ||
3036 | In the second case, all results, | ||
3033 | Lua takes care that the returned values fit into the stack space, | 3037 | Lua takes care that the returned values fit into the stack space, |
3034 | but it does not ensure any extra space in the stack. | 3038 | but it does not ensure any extra space in the stack. |
3035 | The function results are pushed onto the stack in direct order | 3039 | The function results are pushed onto the stack in direct order |
3036 | (the first result is pushed first), | 3040 | (the first result is pushed first), |
3037 | so that after the call the last result is on the top of the stack. | 3041 | so that after the call the last result is on the top of the stack. |
3038 | 3042 | ||
3043 | The maximum value for @id{nresults} is 250. | ||
3044 | |||
3039 | Any error while calling and running the function is propagated upwards | 3045 | Any error while calling and running the function is propagated upwards |
3040 | (with a @id{longjmp}). | 3046 | (with a @id{longjmp}). |
3041 | 3047 | ||