當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。