MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / lua_checkstack

Function lua_checkstack

extlibs/lua/src/lapi.c:98–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96
97
98LUA_API int lua_checkstack (lua_State *L, int n) {
99 int res;
100 CallInfo *ci = L->ci;
101 lua_lock(L);
102 api_check(L, n >= 0, "negative 'n'");
103 if (L->stack_last - L->top > n) /* stack large enough? */
104 res = 1; /* yes; check is OK */
105 else { /* no; need to grow stack */
106 int inuse = cast_int(L->top - L->stack) + EXTRA_STACK;
107 if (inuse > LUAI_MAXSTACK - n) /* can grow without overflow? */
108 res = 0; /* no */
109 else /* try to grow stack */
110 res = luaD_growstack(L, n, 0);
111 }
112 if (res && ci->top < L->top + n)
113 ci->top = L->top + n; /* adjust frame top */
114 lua_unlock(L);
115 return res;
116}
117
118
119LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) {

Callers 6

luaL_checkstackFunction · 0.85
pmainFunction · 0.85
auxresumeFunction · 0.85
tunpackFunction · 0.85
checkstackFunction · 0.85
luaL_checkstackFunction · 0.85

Calls 1

luaD_growstackFunction · 0.85

Tested by

no test coverage detected