MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / lua_checkstack

Function lua_checkstack

third-party/lua-5.2.4/src/lapi.c:92–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90
91
92LUA_API int lua_checkstack (lua_State *L, int size) {
93 int res;
94 CallInfo *ci = L->ci;
95 lua_lock(L);
96 if (L->stack_last - L->top > size) /* stack large enough? */
97 res = 1; /* yes; check is OK */
98 else { /* no; need to grow stack */
99 int inuse = cast_int(L->top - L->stack) + EXTRA_STACK;
100 if (inuse > LUAI_MAXSTACK - size) /* can grow without overflow? */
101 res = 0; /* no */
102 else /* try to grow stack */
103 res = (luaD_rawrunprotected(L, &growstack, &size) == LUA_OK);
104 }
105 if (res && ci->top < L->top + size)
106 ci->top = L->top + size; /* adjust frame top */
107 lua_unlock(L);
108 return res;
109}
110
111
112LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) {

Callers 6

finishpcallFunction · 0.70
luaL_checkstackFunction · 0.70
pmainFunction · 0.70
auxresumeFunction · 0.70
unpackFunction · 0.70
checkstackFunction · 0.70

Calls 1

luaD_rawrunprotectedFunction · 0.70

Tested by

no test coverage detected