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


C# TValue类代码示例

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


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

示例1: T_GetTMByObj

		private StkId T_GetTMByObj( ref TValue o, TMS tm )
		{
			LuaTable mt = null;

			switch( o.Tt )
			{
				case (int)LuaType.LUA_TTABLE:
				{
					var tbl = o.HValue();
					mt = tbl.MetaTable;
					break;
				}
				case (int)LuaType.LUA_TUSERDATA:
				{
					var ud = o.RawUValue();
					mt = ud.MetaTable;
					break;
				}
				default:
				{
					mt = G.MetaTables[o.Tt];
					break;
				}
			}
			return (mt != null)
				 ? mt.GetStr( GetTagMethodName( tm ) )
				 : TheNilValue;
		}
开发者ID:Jornason,项目名称:UniLua,代码行数:28,代码来源:TagMethod.cs

示例2: luaV_tonumber

 public static TValue luaV_tonumber (TValue obj, TValue n) {
     lua_Number num;
     if (ttisnumber(obj)) return obj;
     if (ttisstring(obj) && (luaO_str2d(svalue(obj), out num)!=0)) {
         setnvalue(n, num);
         return n;
     }
     else
         return null;
 }
开发者ID:mlnlover11,项目名称:KopiLua-v5.1.5,代码行数:10,代码来源:lvm.cs

示例3: luaV_tonumber

		public static TValue luaV_tonumber (TValue obj, TValue n) {
		  lua_Number num;
		  if (TTIsNumber(obj)) return obj;
		  if (TTIsString(obj) && (LuaOStr2d(SValue(obj), out num)!=0)) {
			SetNValue(n, num);
			return n;
		  }
		  else
			return null;
		}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数: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: Main

	public static unsafe int Main ()
	{
		TValue[] values = new TValue[10];
		values[0] = new TValue (0L);
		values[1] = new TValue (1000L);
		values[2] = new TValue (1L);
		Console.WriteLine ("values: {0} {1} {2}", values[0], values[1], values[2]);
		fixed (TValue* vals = values) {
			Console.WriteLine ("fixed: {0} {1} {2}", vals[0], vals[1], vals[2]);
			if (vals[0].ToString () != "0")
				return 1;

			if (vals[1].ToString() != "1000")
				return 2;

			if (vals[2].ToString() != "1")
				return 3;
		}

		Console.WriteLine ("ok");
		return 0;
	}
开发者ID:carrie901,项目名称:mono,代码行数:22,代码来源:test-740.cs

示例6: lua_setfield

 public static void lua_setfield(LuaState L, int idx, CharPtr k)
 {
     StkId t;
     TValue key = new TValue();
     lua_lock(L);
     api_checknelems(L, 1);
     t = index2adr(L, idx);
     api_checkvalidindex(L, t);
     setsvalue(L, key, luaS_new(L, k));
     luaV_settable(L, t, key, L.top - 1);
     StkId.dec(ref L.top);  /* pop value */
     lua_unlock(L);
 }
开发者ID:chenzuo,项目名称:SharpLua,代码行数:13,代码来源:lapi.cs

示例7: lua_tointeger

 public static lua_Integer lua_tointeger(LuaState L, int idx)
 {
     TValue n = new TValue();
     TValue o = index2adr(L, idx);
     if (tonumber(ref o, n) != 0)
     {
         lua_Integer res;
         lua_Number num = nvalue(o);
         lua_number2integer(out res, num);
         return res;
     }
     else
         return 0;
 }
开发者ID:chenzuo,项目名称:SharpLua,代码行数:14,代码来源:lapi.cs

示例8: lua_isnumber

 public static int lua_isnumber(LuaState L, int idx)
 {
     TValue n = new TValue();
     TValue o = index2adr(L, idx);
     return tonumber(ref o, n);
 }
开发者ID:chenzuo,项目名称:SharpLua,代码行数:6,代码来源:lapi.cs

示例9: lua_getupvalue

 public static CharPtr lua_getupvalue(LuaState L, int funcindex, int n)
 {
     CharPtr name;
     TValue val = new TValue();
     lua_lock(L);
     name = aux_upvalue(index2adr(L, funcindex), n, ref val);
     if (name != null)
     {
         setobj2s(L, L.top, val);
         api_incr_top(L);
     }
     lua_unlock(L);
     return name;
 }
开发者ID:chenzuo,项目名称:SharpLua,代码行数:14,代码来源:lapi.cs

示例10: AddK

		private static int AddK (FuncState fs, TValue k, TValue v) {
		  LuaState L = fs.L;
		  TValue idx = luaH_set(L, fs.h, k);
		  Proto f = fs.f;
		  int oldsize = f.sizek;
		  if (TTIsNumber(idx)) {
			LuaAssert(LuaORawEqualObj(fs.f.k[CastInt(NValue(idx))], v));
			return CastInt(NValue(idx));
		  }
		  else {  /* constant not found; create a new entry */
			SetNValue(idx, CastNum(fs.nk));
			LuaMGrowVector(L, ref f.k, fs.nk, ref f.sizek,
							MAXARG_Bx, "constant table overflow");
			while (oldsize < f.sizek) SetNilValue(f.k[oldsize++]);
			SetObj(L, f.k[fs.nk], v);
			LuaCBarrier(L, f, v);
			return fs.nk++;
		  }
		}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:19,代码来源:lcode.cs

示例11: boolK

		private static int boolK (FuncState fs, int b) {
		  TValue o = new TValue();
		  setbvalue(o, b);
		  return addk(fs, o, o);
		}
开发者ID:mlnlover11,项目名称:KopiLua-v5.1.5,代码行数:5,代码来源:lcode.cs

示例12: countint

		private static int countint (TValue key, int[] nums) {
		  int k = arrayindex(key);
		  if (0 < k && k <= MAXASIZE) {  /* is `key' an appropriate array index? */
			nums[CeilLog2(k)]++;  /* count as such */
			return 1;
		  }
		  else
			return 0;
		}
开发者ID:oathx,项目名称:Six,代码行数:9,代码来源:ltable.cs

示例13: arrayindex

		/*
		** returns the index for `key' if `key' is an appropriate key to live in
		** the array part of the table, -1 otherwise.
		*/
		private static int arrayindex (TValue key) {
		  if (TTIsNumber(key)) {
			lua_Number n = NValue(key);
			int k;
			lua_number2int(out k, n);
			if (luai_numeq(CastNum(k), n))
			  return k;
		  }
		  return -1;  /* `key' did not match some condition */
		}
开发者ID:oathx,项目名称:Six,代码行数:14,代码来源:ltable.cs

示例14: LuaGOrderError

		public static int LuaGOrderError (LuaState L, TValue p1, TValue p2) {
		  CharPtr t1 = luaT_typenames[TType(p1)];
		  CharPtr t2 = luaT_typenames[TType(p2)];
		  if (t1[2] == t2[2])
			LuaGRunError(L, "attempt to compare two %s values", t1);
		  else
			LuaGRunError(L, "attempt to compare %s with %s", t1, t2);
		  return 0;
		}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:9,代码来源:ldebug.cs

示例15: LuaGArithError

		public static void LuaGArithError (LuaState L, TValue p1, TValue p2) {
		  TValue temp = new LuaTypeValue();
		  if (luaV_tonumber(p1, temp) == null)
			p2 = p1;  /* first operand is wrong */
		  LuaGTypeError(L, p2, "perform arithmetic on");
		}
开发者ID:ZoneBeat,项目名称:FAForeverMapEditor,代码行数:6,代码来源:ldebug.cs


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