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


C# LuaValue.ToString方法代码示例

本文整理汇总了C#中LuaValue.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# LuaValue.ToString方法的具体用法?C# LuaValue.ToString怎么用?C# LuaValue.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LuaValue的用法示例。


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

示例1: LuaException

		public LuaValue this[LuaRuntime runtime, LuaValue keyValue]
		{
			get
			{
				var name = keyValue.ToString();
				ScriptMemberWrapper wrapper;
				if (!members.TryGetValue(name, out wrapper))
					throw new LuaException(MemberNotFoundError(name));

				return wrapper.Get(runtime);
			}

			set
			{
				var name = keyValue.ToString();
				ScriptMemberWrapper wrapper;
				if (!members.TryGetValue(name, out wrapper))
					throw new LuaException(MemberNotFoundError(name));

				wrapper.Set(runtime, value);
			}
		}
开发者ID:Berzeger,项目名称:OpenRA,代码行数:22,代码来源:ScriptObjectWrapper.cs

示例2: switch

        public LuaValue this[LuaRuntime runtime, LuaValue key]
        {
            get
            {
                switch (key.ToString())
                {
                    case "X": return X;
                    case "Y": return Y;
                    default: throw new LuaException("CPos does not define a member '{0}'".F(key));
                }
            }

            set
            {
                throw new LuaException("CPos is read-only. Use CPos.New to create a new value");
            }
        }
开发者ID:RunCraze,项目名称:OpenRA,代码行数:17,代码来源:CPos.cs

示例3: switch

        public LuaValue this[LuaRuntime runtime, LuaValue key]
        {
            get
            {
                switch (key.ToString())
                {
                    case "X": return X;
                    case "Y": return Y;
                    case "Facing": return Traits.Util.GetFacing(this, 0);
                    default: throw new LuaException("CVec does not define a member '{0}'".F(key));
                }
            }

            set
            {
                throw new LuaException("WVec is read-only. Use CVec.New to create a new value");
            }
        }
开发者ID:RunCraze,项目名称:OpenRA,代码行数:18,代码来源:CVec.cs

示例4: GetValueString

		public string GetValueString(LuaValue luaValue)
		{
			if (luaValue == null)
				return "";

			switch (luaValue.Type)
			{
				case LuaValueType.NIL:
					return "nil";

				case LuaValueType.BOOLEAN:
					return luaValue.AsBoolean().ToString();

				case LuaValueType.NUMBER:
					return luaValue.AsNumber().ToString("R");

				case LuaValueType.TILDE_METATABLE:
					return "metatable";

				case LuaValueType.TILDE_ENVIRONMENT:
					return "environment";

				case LuaValueType.TILDE_UPVALUES:
					return "upvalues";

				default:
					if (mValueCache.Contains(luaValue))
						return mValueCache.Get(luaValue);
					else
						return "Unknown:" + luaValue.ToString();
			}
		}
开发者ID:zcnet4,项目名称:lua-tilde,代码行数:32,代码来源:DebugManager.cs

示例5: PrintTable

        private static void PrintTable(LuaTable tbl, string indent, LuaValue _key = null)
        {
            /* sample output:
                    table: 002CCBA8
                    {
                        field = value
                        X = 10
                        y = function: 002CCBA8
                    }
             */
            string i = indent;
            A8Console.Write(i);
            if (_key != null)
                A8Console.Write(_key.ToString() + " = ");
            A8Console.WriteLine(tbl.ToString() + "\n" + i + "{");

            foreach (LuaValue key in tbl.Keys)
            {
                LuaValue v = tbl.GetValue(key);
                if (v.GetTypeCode() == "table")
                {
                    // check that its not a reference of itself
                    if (!scanned.ContainsKey(key))
                    {
                        scanned.SetKeyValue(key, v);
                        PrintTable(v as LuaTable, i + " ", key);
                    }
                    else
                    {
                        A8Console.WriteLine(i + " " + key.ToString() + " = " + v.ToString());
                    }
                }
                else
                {
                    scanned.SetKeyValue(key, v);
                    A8Console.WriteLine(i + " " + key.ToString() + " = " + v.ToString());
                }
            }/*
            foreach (LuaValue key in tbl.MetaTable.Keys)
            {
                A8Console.WriteLine(i + "(MetaTable): " + key.ToString() + " = " + tbl.MetaTable.GetValue(key).ToString());
            }*/
            A8Console.WriteLine(i + "}");
        }
开发者ID:Majiir,项目名称:MuMechLib,代码行数:44,代码来源:TableLib.cs


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