public GlobalState(LuaState state) { MainThread = state; Registry = new StkId(); UpvalHead = new LuaUpvalue(); MetaTables = new LuaTable[(int)LuaType.LUA_NUMTAGS]; }
public LuaLClosureValue(LuaProto p) { Proto = p; Upvals = new LuaUpvalue[p.Upvalues.Count]; for (int i = 0; i < p.Upvalues.Count; ++i) { Upvals[i] = new LuaUpvalue(); } }
private LuaUpvalue F_FindUpval(StkId level) { #if DEBUG_FIND_UPVALUE ULDebug.Log("[F_FindUpval] >>>>>>>>>>>>>>>>>>>> level:" + level); #endif var node = OpenUpval.First; LinkedListNode <LuaUpvalue> prev = null; while (node != null) { var upval = node.Value; #if DEBUG_FIND_UPVALUE ULDebug.Log("[F_FindUpval] >>>>>>>>>>>>>>>>>>>> upval.V:" + upval.V); #endif if (upval.V.Index < level.Index) { break; } var next = node.Next; if (upval.V == level) { return(upval); } prev = node; node = next; } // not found: create a new one var ret = new LuaUpvalue(); ret.V = level; // ret.Prev = G.UpvalHead; // ret.Next = G.UpvalHead.Next; // ret.Next.Prev = ret; // G.UpvalHead.Next = ret; if (prev == null) { OpenUpval.AddFirst(ret); } else { OpenUpval.AddAfter(prev, ret); } #if DEBUG_FIND_UPVALUE ULDebug.Log("[F_FindUpval] >>>>>>>>>>>>>>>>>>>> create new one:" + ret.V); #endif return(ret); }