aboutsummaryrefslogtreecommitdiff
path: root/manual
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-07-18 14:44:40 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2024-07-18 14:44:40 -0300
commita546138d158d79d44b2c5b42630be00d306f4e7c (patch)
tree8d2410921dc1af4dc8e7d19b21d3f313bcc812b4 /manual
parentcd4de92762434e6ed0e6c207d56d365300396dd8 (diff)
downloadlua-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.of10
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,
3028all arguments and the function value are popped 3028all arguments and the function value are popped
3029and the call results are pushed onto the stack. 3029and the call results are pushed onto the stack.
3030The number of results is adjusted to @id{nresults}, 3030The number of results is adjusted to @id{nresults},
3031unless @id{nresults} is @defid{LUA_MULTRET}. 3031unless @id{nresults} is @defid{LUA_MULTRET},
3032In this case, all results from the function are pushed; 3032which makes all results from the function to be pushed.
3033In the first case, an explicit number of results,
3034the caller must ensure that the stack has space for the
3035returned values.
3036In the second case, all results,
3033Lua takes care that the returned values fit into the stack space, 3037Lua takes care that the returned values fit into the stack space,
3034but it does not ensure any extra space in the stack. 3038but it does not ensure any extra space in the stack.
3035The function results are pushed onto the stack in direct order 3039The function results are pushed onto the stack in direct order
3036(the first result is pushed first), 3040(the first result is pushed first),
3037so that after the call the last result is on the top of the stack. 3041so that after the call the last result is on the top of the stack.
3038 3042
3043The maximum value for @id{nresults} is 250.
3044
3039Any error while calling and running the function is propagated upwards 3045Any error while calling and running the function is propagated upwards
3040(with a @id{longjmp}). 3046(with a @id{longjmp}).
3041 3047