MCPcopy Create free account
hub / github.com/Tencent/sluaunreal / lua_checkstack

Function lua_checkstack

Plugins/slua_unreal/External/lua/lapi.cpp:95–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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