mirror of
https://github.com/jugeeya/UltimateTrainingModpack.git
synced 2024-11-24 19:04:16 +00:00
37 lines
1,001 B
C
37 lines
1,001 B
C
/*
|
|
** $Id: lapi.h $
|
|
** Auxiliary functions from Lua API
|
|
** See Copyright Notice in lua.h
|
|
*/
|
|
|
|
#ifndef lapi_h
|
|
#define lapi_h
|
|
|
|
|
|
#include "llimits.h"
|
|
#include "lstate.h"
|
|
|
|
#define api_incr_top(L) {L->top++; api_check(L, L->top <= L->ci->top, \
|
|
"stack overflow");}
|
|
|
|
#define adjustresults(L,nres) \
|
|
{ if ((nres) <= LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; }
|
|
|
|
#define api_checknelems(L,n) api_check(L, (n) < (L->top - L->ci->func), \
|
|
"not enough elements in the stack")
|
|
|
|
|
|
/*
|
|
** To reduce the overhead of returning from C functions, the presence of
|
|
** to-be-closed variables in these functions is coded in the CallInfo's
|
|
** field 'nresults', in a way that functions with no to-be-closed variables
|
|
** with zero, one, or "all" wanted results have no overhead. Functions
|
|
** with other number of wanted results, as well as functions with
|
|
** variables to be closed, have an extra check.
|
|
*/
|
|
|
|
#define hastocloseCfunc(n) ((n) < LUA_MULTRET)
|
|
|
|
#define codeNresults(n) (-(n) - 3)
|
|
|
|
#endif
|