MCPcopy Create free account
hub / github.com/Cocos-BCX/cocos-mainnet / lua_checkstack

Function lua_checkstack

libraries/lua-gph/lib/src/lapi.cpp:105–125  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 8

lua_schedulerMethod · 0.85
pmainFunction · 0.85
auxresumeFunction · 0.85
json_check_encode_depthFunction · 0.85
json_decode_descendFunction · 0.85
unpackFunction · 0.85
luaL_checkstackFunction · 0.85
checkstackFunction · 0.85

Calls 1

luaD_rawrunprotectedFunction · 0.85

Tested by

no test coverage detected