diff options
Diffstat (limited to 'lapi.h')
-rw-r--r-- | lapi.h | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -15,10 +15,23 @@ | |||
15 | "stack overflow");} | 15 | "stack overflow");} |
16 | 16 | ||
17 | #define adjustresults(L,nres) \ | 17 | #define adjustresults(L,nres) \ |
18 | { if ((nres) == LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; } | 18 | { if ((nres) <= LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; } |
19 | 19 | ||
20 | #define api_checknelems(L,n) api_check(L, (n) < (L->top - L->ci->func), \ | 20 | #define api_checknelems(L,n) api_check(L, (n) < (L->top - L->ci->func), \ |
21 | "not enough elements in the stack") | 21 | "not enough elements in the stack") |
22 | 22 | ||
23 | 23 | ||
24 | /* | ||
25 | ** To reduce the overhead of returning from C functions, the presence of | ||
26 | ** to-be-closed variables in these functions is coded in the CallInfo's | ||
27 | ** field 'nresults', in a way that functions with no to-be-closed variables | ||
28 | ** with zero, one, or "all" wanted results have no overhead. Functions | ||
29 | ** with other number of wanted results, as well as functions with | ||
30 | ** variables to be closed, have an extra check. | ||
31 | */ | ||
32 | |||
33 | #define hastocloseCfunc(n) ((n) < LUA_MULTRET) | ||
34 | |||
35 | #define codeNresults(n) (-(n) - 3) | ||
36 | |||
24 | #endif | 37 | #endif |