本文整理汇总了C#中LuaTable.GetMemberValue方法的典型用法代码示例。如果您正苦于以下问题:C# LuaTable.GetMemberValue方法的具体用法?C# LuaTable.GetMemberValue怎么用?C# LuaTable.GetMemberValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LuaTable
的用法示例。
在下文中一共展示了LuaTable.GetMemberValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Button_Click_1
private void Button_Click_1(object sender, RoutedEventArgs e)
{
using (Lua l = new Lua())
{
var t = new LuaTable();
var c = l.CompileChunk(
String.Join(Environment.NewLine,
"local v1 = 2;",
"local v2 = 4;",
"function f()",
" return v1 + v2;",
"end;",
"return f();"), "test", null);
var r = c.Run(t);
txtResult.Text = String.Format("Test: v1=[{0}], v2=[{1}], r={2}", Lua.RtGetUpValue(t.GetMemberValue("f") as Delegate, 1), Lua.RtGetUpValue(t.GetMemberValue("f") as Delegate, 2), r.ToInt32());
}
}
示例2: Main
static void Main(string[] args)
{
Console.Write(TestAsync().Result);
using (Lua l = new Lua())
{
var t = new LuaTable();
var c = l.CompileChunk(
String.Join(Environment.NewLine,
"local v1 = 2;",
"local v2 = 4;",
"function f()",
" return v1 + v2;",
"end;",
"return f();"), "test", null);
var r = c.Run(t);
Console.WriteLine("Test: v1=[{0}], v2=[{1}], r={2}", Lua.RtGetUpValue(t.GetMemberValue("f") as Delegate, 1), Lua.RtGetUpValue(t.GetMemberValue("f") as Delegate, 2), r.ToInt32());
}
//LinqTest2();
Console.ReadKey();
}
示例3: TestMember01
public void TestMember01()
{
LuaTable t = new LuaTable();
t["test"] = "t";
Assert.AreEqual(t["test"], "t");
t.SetMemberValue("Test", "a", true);
Assert.AreEqual(t.GetMemberValue("Test", true, true), "a");
t.SetMemberValue("Test", "b");
Assert.AreEqual(t["Test"], "b");
t.SetMemberValue("Test", "n", true);
Assert.AreEqual(t["test"], "n");
IDictionary<string, object> a = t.Members;
string[] r = new string[2];
a.Keys.CopyTo(r, 0);
Assert.IsTrue(r[0] == "test" && r[1] == "Test");
t.SetMemberValue("Test", null, true, true);
t.SetMemberValue("Test", null, true, true);
Assert.IsTrue(t["Test"] == null);
Assert.IsTrue(t["test"] == null);
}
示例4: GSubLuaTableMatchEvaluator
public GSubLuaTableMatchEvaluator(LuaTable t)
{
this.t = t;
this.lIgnoreCase = (bool)Lua.RtConvertValue(t.GetMemberValue("__IgnoreCase"), typeof(bool));
}