bool ILuaAPI.CheckStack(int size) { bool res = false; if (StackLast - Top.Index > size) { res = true; } // need to grow stack else { int inuse = Top.Index + LuaDef.EXTRA_STACK; if (inuse > LuaConf.LUAI_MAXSTACK - size) { res = false; } else { var param = new GrowStackParam(); param.L = this; param.size = size; res = D_RawRunProtected(DG_GrowStack, ref param) == ThreadStatus.LUA_OK; } } if (res && CI.TopIndex < Top.Index + size) { CI.TopIndex = Top.Index + size; // adjust frame top } return(res); }
bool ILuaAPI.CheckStack(int size) { bool res = false; if(StackLast - Top.Index > size) { res = true; } // need to grow stack else { int inuse = Top.Index + LuaDef.EXTRA_STACK; if(inuse > LuaConf.LUAI_MAXSTACK - size) res = false; else { var param = new GrowStackParam(); param.L = this; param.size = size; res = D_RawRunProtected(DG_GrowStack, ref param)==ThreadStatus.LUA_OK; } } if(res && CI.TopIndex < Top.Index + size) CI.TopIndex = Top.Index + size; // adjust frame top return res; }
private static void GrowStackWrap(ref GrowStackParam param) { param.L.GrowStack(param.size); }