MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / lua_checkstack

Function lua_checkstack

src/Chain/libraries/glua/lapi.cpp:100–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 5

auxresumeFunction · 0.85
unpackFunction · 0.85
luaL_checkstackFunction · 0.85
checkstackFunction · 0.85
pmainFunction · 0.85

Calls 1

luaD_rawrunprotectedFunction · 0.85

Tested by

no test coverage detected