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


C# Lua.GetString方法代码示例

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


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

示例1: SetTableStringField2

		public void SetTableStringField2 ()
		{
			using (Lua lua = new Lua ()) {
				lua.DoString ("a={b={c=\"test\"}}");
				LuaTable tab = lua.GetTable ("a");
				tab ["b.c"] = "new test";
				string str = lua.GetString ("a.b.c");
				//Console.WriteLine("a.b.c="+str);
				Assert.AreEqual (str, "new test");
			}
		}
开发者ID:The-Megax,项目名称:NLua,代码行数:11,代码来源:LuaTests.cs

示例2: SetStringInTable

		public void SetStringInTable ()
		{
			using (Lua lua = new Lua ()) {
				lua.DoString ("a={b={c=\"test\"}}");
				lua ["a.b.c"] = "new test";
				string str = lua.GetString ("a.b.c");
				//Console.WriteLine("a.b.c="+str);
				Assert.AreEqual (str, "new test");
			}
		}
开发者ID:The-Megax,项目名称:NLua,代码行数:10,代码来源:LuaTests.cs

示例3: SetGlobalString

		public void SetGlobalString ()
		{
			using (Lua lua = new Lua ()) {
				lua.DoString ("a=\"test\"");
				lua ["a"] = "new test";
				string str = lua.GetString ("a");
				//Console.WriteLine("a="+str);
				Assert.AreEqual (str, "new test");
			}
		}
开发者ID:The-Megax,项目名称:NLua,代码行数:10,代码来源:LuaTests.cs

示例4: TestMultipleOutParameters

		public void TestMultipleOutParameters ()
		{
			using (Lua lua = new Lua ()) {
				TestClass t1 = new TestClass ();
				lua ["netobj"] = t1;
				lua.DoString ("a,b,c=netobj:outValMutiple(2)");
				int a = (int)lua.GetNumber ("a");
				string b = (string)lua.GetString ("b");
				string c = (string)lua.GetString ("c");
				Assert.AreEqual (2, a);
				Assert.AreNotEqual (null, b);
				Assert.AreNotEqual (null, c);
			}
		}
开发者ID:The-Megax,项目名称:NLua,代码行数:14,代码来源:LuaTests.cs

示例5: ReadArrayField

		public void ReadArrayField ()
		{
			using (Lua lua = new Lua ()) {
				string[] arr = new string [] { "str1", "str2", "str3" };
				lua ["netobj"] = arr;
				lua.DoString ("val=netobj[1]");
				string val = lua.GetString ("val");
				Assert.AreEqual ("str2", val);
				//Console.WriteLine("new val(from array to Lua)="+val);
			}
		}
开发者ID:The-Megax,项目名称:NLua,代码行数:11,代码来源:LuaTests.cs

示例6: TestConstructorOverload

		public void TestConstructorOverload ()
		{
			using (var l = new Lua ()) {
				l.LoadCLRPackage ();
				l.DoString (" import ('NLuaTest','NLuaTest.Mock') ");
				l.DoString (@"					
					e1 = Entity()
					e2 = Entity ('str_param')
					e3 = Entity (10)
					p1 = e1.Property
					p2 = e2.Property
					p3 = e3.Property
				");
				string p1 = l.GetString ("p1");
				string p2 = l.GetString ("p2");
				string p3 = l.GetString ("p3");
				Assert.AreEqual ("Default", p1, "#1");
				Assert.AreEqual ("String", p2, "#1");
				Assert.AreEqual ("Int", p3, "#1");
			}
		}
开发者ID:zhangf911,项目名称:NLua,代码行数:21,代码来源:LuaTests.cs


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