当前位置: 首页>>代码示例>>C#>>正文


C# StkId类代码示例

本文整理汇总了C#中StkId的典型用法代码示例。如果您正苦于以下问题:C# StkId类的具体用法?C# StkId怎么用?C# StkId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


StkId类属于命名空间,在下文中一共展示了StkId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: luaF_findupval

		public static UpVal luaF_findupval (LuaState L, StkId level) {
		  GlobalState g = G(L);
		  GCObjectRef pp = new OpenValRef(L);
		  UpVal p;
		  UpVal uv;
		  while (pp.get() != null && (p = ngcotouv(pp.get())).v >= level) {
			lua_assert(p.v != p.u.value);
			if (p.v == level) {  /* found a corresponding upvalue? */
			  if (isdead(g, obj2gco(p)))  /* is it dead? */
				changewhite(obj2gco(p));  /* ressurect it */
			  return p;
			}
			pp = new NextRef(p);
		  }
		  uv = luaM_new<UpVal>(L);  /* not found: create a new one */
		  uv.tt = LUA_TUPVAL;
		  uv.marked = luaC_white(g);
		  uv.v = level;  /* current value lives in the stack */
		  uv.next = pp.get();  /* chain it in the proper position */
		  pp.set( obj2gco(uv) );
		  uv.u.l.prev = g.uvhead;  /* double link it in `uvhead' list */
		  uv.u.l.next = g.uvhead.u.l.next;
		  uv.u.l.next.u.l.prev = uv;
		  g.uvhead.u.l.next = uv;
		  lua_assert(uv.u.l.next.u.l.prev == uv && uv.u.l.prev.u.l.next == uv);
		  return uv;
		}
开发者ID:chenzuo,项目名称:SharpLua,代码行数:27,代码来源:lfunc.cs

示例2: luaV_tostring

		public static int luaV_tostring (LuaState L, StkId obj) {
		  if (!TTIsNumber(obj))
			return 0;
		  else {
			lua_Number n = NValue(obj);
			CharPtr s = lua_number2str(n);
			SetSValue2S(L, obj, luaS_new(L, s));
			return 1;
		  }
		}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:10,代码来源:lvm.cs

示例3: luaV_tostring

 public static int luaV_tostring (lua_State L, StkId obj) {
     if (!ttisnumber(obj))
         return 0;
     else {
         lua_Number n = nvalue(obj);
         CharPtr s = lua_number2str(n);
         setsvalue2s(L, obj, luaS_new(L, s));
         return 1;
     }
 }
开发者ID:mlnlover11,项目名称:KopiLua-v5.1.5,代码行数:10,代码来源:lvm.cs

示例4: callTMres

 private static void callTMres (lua_State L, StkId res, TValue f,
                                TValue p1, TValue p2) {
     ptrdiff_t result = savestack(L, res);
     setobj2s(L, L.top, f);  /* push function */
     setobj2s(L, L.top+1, p1);  /* 1st argument */
     setobj2s(L, L.top+2, p2);  /* 2nd argument */
     luaD_checkstack(L, 3);
     L.top += 3;
     luaD_call(L, L.top-3, 1);
     res = restorestack(L, result);
     StkId.dec(ref L.top);
     setobjs2s(L, res, L.top);
 }
开发者ID:mlnlover11,项目名称:KopiLua-v5.1.5,代码行数:13,代码来源:lvm.cs

示例5: SaveStack

 // in the original C code these values save and restore the stack by number of bytes. marshalling sizeof
 // isn't that straightforward in managed languages, so i implement these by index instead.
 public static int SaveStack(LuaState L, StkId p)
 {
     return p;
 }
开发者ID:arkanoid1,项目名称:FakePacketSender,代码行数:6,代码来源:ldo.cs

示例6: LuaDSetErrorObj

 public static void LuaDSetErrorObj(LuaState L, int errcode, StkId oldtop)
 {
     switch (errcode)
     {
         case LUA_ERRMEM:
             {
                 SetSValue2S(L, oldtop, luaS_newliteral(L, MEMERRMSG));
                 break;
             }
         case LUA_ERRERR:
             {
                 SetSValue2S(L, oldtop, luaS_newliteral(L, "error in error handling"));
                 break;
             }
         case LUA_ERRSYNTAX:
         case LUA_ERRRUN:
             {
                 SetObj2S(L, oldtop, L.top - 1);  /* error message on current top */
                 break;
             }
     }
     L.top = oldtop + 1;
 }
开发者ID:arkanoid1,项目名称:FakePacketSender,代码行数:23,代码来源:ldo.cs

示例7: aux_upvalue

 static CharPtr aux_upvalue(StkId fi, int n, ref TValue val)
 {
     Closure f;
     if (!ttisfunction(fi)) return null;
     f = clvalue(fi);
     if (f.c.isC != 0)
     {
         if (!(1 <= n && n <= f.c.nupvalues)) return null;
         val = f.c.upvalue[n - 1];
         return "";
     }
     else
     {
         Proto p = f.l.p;
         if (!(1 <= n && n <= p.sizeupvalues)) return null;
         val = f.l.upvals[n - 1].v;
         return getstr(p.upvalues[n - 1]);
     }
 }
开发者ID:chenzuo,项目名称:SharpLua,代码行数:19,代码来源:lapi.cs

示例8: LuaGConcatError

		public static void LuaGConcatError (LuaState L, StkId p1, StkId p2) {
		  if (TTIsString(p1) || TTIsNumber(p1)) p1 = p2;
		  LuaAssert(!TTIsString(p1) && !TTIsNumber(p1));
		  LuaGTypeError(L, p1, "concatenate");
		}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:5,代码来源:ldebug.cs

示例9: luaV_settable

		public static void luaV_settable (LuaState L, TValue t, TValue key, StkId val) {
		  int loop;
		  TValue temp = new LuaTypeValue();
		  for (loop = 0; loop < MAXTAGLOOP; loop++) {
			TValue tm;
			if (TTIsTable(t)) {  /* `t' is a table? */
			  Table h = HValue(t);
			  TValue oldval = luaH_set(L, h, key); /* do a primitive set */
			  if (!TTIsNil(oldval) ||  /* result is no nil? */
				  (tm = fasttm(L, h.metatable, TMS.TM_NEWINDEX)) == null) { /* or no TM? */
				SetObj2T(L, oldval, val);
			    h.flags = 0;
				LuaCBarrierT(L, h, val);
				return;
			  }
			  /* else will try the tag method */
			}
			else if (TTIsNil(tm = luaT_gettmbyobj(L, t, TMS.TM_NEWINDEX)))
			  LuaGTypeError(L, t, "index");
			if (TTIsFunction(tm)) {
			  callTM(L, tm, t, key, val);
			  return;
			}
			/* else repeat with `tm' */
			SetObj (L, temp, tm); /* avoid pointing inside table (may rehash) */
			t = temp;
		  }
		  LuaGRunError(L, "loop in settable");
		}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:29,代码来源:lvm.cs

示例10: RKC

		internal static TValue RKC(LuaState L, StkId base_, Instruction i, TValue[] k) { return ISK(GETARG_C(i)) != 0 ? k[INDEXK(GETARG_C(i))] : base_ + GETARG_C(i); }
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:1,代码来源:lvm.cs

示例11: TryFuncTM

 private static StkId TryFuncTM(LuaState L, StkId func)
 {
     /*const*/
     TValue tm = luaT_gettmbyobj(L, func, TMS.TM_CALL);
     StkId p;
     ptrdiff_t funcr = SaveStack(L, func);
     if (!TTIsFunction(tm))
         LuaGTypeError(L, func, "call");
     /* Open a hole inside the stack at `func' */
     for (p = L.top; p > func; StkId.Dec(ref p)) SetObj2S(L, p, p - 1);
     IncrTop(L);
     func = RestoreStack(L, funcr);  /* previous call may change stack */
     SetObj2S(L, func, tm);  /* tag method is the new function to be called */
     return func;
 }
开发者ID:arkanoid1,项目名称:FakePacketSender,代码行数:15,代码来源:ldo.cs

示例12: Arith

		public static void Arith (LuaState L, StkId ra, TValue rb,
						   TValue rc, TMS op) {
		  TValue tempb = new LuaTypeValue(), tempc = new LuaTypeValue();
		  TValue b, c;
		  if ((b = luaV_tonumber(rb, tempb)) != null &&
			  (c = luaV_tonumber(rc, tempc)) != null) {
			lua_Number nb = NValue(b), nc = NValue(c);
			switch (op) {
			  case TMS.TM_ADD: SetNValue(ra, luai_numadd(nb, nc)); break;
			  case TMS.TM_SUB: SetNValue(ra, luai_numsub(nb, nc)); break;
			  case TMS.TM_MUL: SetNValue(ra, luai_nummul(nb, nc)); break;
			  case TMS.TM_DIV: SetNValue(ra, luai_numdiv(nb, nc)); break;
			  case TMS.TM_MOD: SetNValue(ra, luai_nummod(nb, nc)); break;
			  case TMS.TM_POW: SetNValue(ra, luai_numpow(nb, nc)); break;
			  case TMS.TM_UNM: SetNValue(ra, luai_numunm(nb)); break;
			  default: LuaAssert(false); break;
			}
		  }
		  else if (call_binTM(L, rb, rc, ra, op) == 0)
			LuaGArithError(L, rb, rc);
		}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:21,代码来源:lvm.cs

示例13: RC

		internal static TValue RC(LuaState L, StkId base_, Instruction i) { return base_ + GETARG_C(i); }
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:1,代码来源:lvm.cs

示例14: tonumber

		public static int tonumber(ref StkId o, TValue n) {
			return ((TType(o) == LUA_TNUMBER || (((o) = luaV_tonumber(o, n)) != null))) ? 1 : 0;
		}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:3,代码来源:lvm.cs

示例15: tostring

		public static int tostring(LuaState L, StkId o) {
			return ((TType(o) == LUA_TSTRING) || (luaV_tostring(L, o) != 0)) ? 1 : 0;
		}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:3,代码来源:lvm.cs


注:本文中的StkId类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。