Moonsharp 中的表值返回为空

我刚开始在 c# 中使用 Moonsharp,并尝试测试一些事物,例如从表中检索一个值。然而编译器告诉我值 t 为空。从 test 中检索数值的正确方法是什么?

script.lua:

test = {
 number = 3
}

c# 代码片段:

        Script s = new Script();
        s.LoadFile("res/script.lua");
        Table t = s.Globals["test"] as Table;
        DynValue n = t.Get("number");

谢谢!

点赞