本文整理汇总了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");
}
}
示例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");
}
}
示例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");
}
}
示例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);
}
}
示例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);
}
}
示例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");
}
}