public lua_TValue(lua_TValue copy) { this.values = copy.values; this.index = copy.index; this.value.Copy(copy.value); this.tt = copy.tt; }
public lua_TValue(lua_TValue value) { this.values = value.values; this.index = value.index; this.value_ = value.value_; // todo: do a shallow copy here this.tt_ = value.tt_; }
private static void traversestack(global_State g, lua_State L) { StkId o; if (L.stack == null) { return; /* stack not completely built yet */ } for (o = new lua_TValue(L.stack); o < L.top; /*StkId.inc(ref o)*/ o = o + 1) //FIXME:L.stack->new StkId(L.stack[0]) //FIXME:don't use StackId.inc(), overflow ([-1]) { markvalue(g, o); //------------------------ if (o >= L.top - 1) { break; //FIXME:added, o + 1 will overflow } //------------------------ } if (g.gcstate == GCSatomic) /* final traversal? */ { StkId limMinus1 = L.stack[L.stacksize - 1]; /* real end of stack */ //FIXME:L.stack[L.stacksize] will overvlow, changed it for (; o <= limMinus1; /*StkId.inc(ref o)*/ o = o + 1) /* clear not-marked stack slice */ //FIXME:overflow, changed 'o < lim' to 'o <= limMinus1' { setnilvalue(o); //------------------------ if (o >= L.top - 1) { break; //FIXME:added, o + 1 will overflow } //------------------------ } } }
public static void copy(lua_TValue v1, lua_TValue v2) { v1.value_ = v2.value_; v1.tt_ = v2.tt_; //FIXME:???see setobj() // v1.index = v2.index; // v1.value_ = v2.value_; // v1._parent = v2._parent; }
private static void traversestack(global_State g, lua_State L) { StkId o; if (L.stack == null) { return; /* stack not completely built yet */ } markvalue(g, gt(L)); /* mark global table */ for (o = new lua_TValue(L.stack); o < L.top; o = o + 1) //FIXME:L.stack->new StkId(L.stack[0]) //FIXME:don't use lua_TValue.inc(), overflow ([-1]) { markvalue(g, o); } if (g.gcstate == GCSatomic) /* final traversal? */ { for (; o <= L.stack_last; StkId.inc(ref o)) /* clear not-marked stack slice */ { setnilvalue(o); } } }
public static lua_TValue dec(ref lua_TValue value) { value = value[-1]; return(value[1]); }
public static lua_TValue inc(ref lua_TValue value) { value = value[1]; return value[-1]; }
public static void inc(ref lua_TValue value, int n) { value = value[n]; }
public static void dec(ref lua_TValue value, int n) { value = value[-n]; }