示例#1
0
        public void FunctionScopesTest()
        {
            LuaParser parser;

            var context = new LuaContext();
            context.AddBasicLibrary();
            context.AddIoLibrary();

            parser = new LuaParser(context, "functionscopes.lua");
            parser.Parse();
        }
示例#2
0
        public void HelloWorldTest()
        {
            LuaParser parser;

            var context = new LuaContext();
            context.AddBasicLibrary();
            context.AddIoLibrary();

            parser = new LuaParser(context, "helloworld.lua");
            parser.Parse();
        }
示例#3
0
        public void DoFileTest()
        {
            LuaParser parser;

            var context = new LuaContext();
            context.AddBasicLibrary();
            context.AddIoLibrary();

            parser = new LuaParser(context, "dofile.lua");
            parser.Parse();
        }
示例#4
0
        public void HelloWorldTest()
        {
            LuaParser parser;

            var context = new LuaContext();

            context.AddBasicLibrary();
            context.AddIoLibrary();

            parser = new LuaParser(context, "helloworld.lua");
            parser.Parse();
        }
示例#5
0
        public void FunctionScopesTest()
        {
            LuaParser parser;

            var context = new LuaContext();

            context.AddBasicLibrary();
            context.AddIoLibrary();

            parser = new LuaParser(context, "functionscopes.lua");
            parser.Parse();
        }
示例#6
0
        public void DoFileTest()
        {
            LuaParser parser;

            var context = new LuaContext();

            context.AddBasicLibrary();
            context.AddIoLibrary();

            parser = new LuaParser(context, "dofile.lua");
            parser.Parse();
        }
示例#7
0
        public void MethodBinding()
        {
            LuaParser parser;

            var context = new LuaContext();
            context.AddBasicLibrary();
            context.AddIoLibrary();
            double res = 0;
            var func = (Func<double, double>)((a) =>
                {
                    res = a;
                    return a + 1;
                });
            context.SetGlobal("test", LuaObject.FromDelegate(func));
            parser = new LuaParser(context, new StringReader("test(123)"));
            parser.Parse();
            Assert.AreEqual(123.0,res);
        }
示例#8
0
        public void MethodBinding()
        {
            LuaParser parser;

            var context = new LuaContext();

            context.AddBasicLibrary();
            context.AddIoLibrary();
            double res  = 0;
            var    func = (Func <double, double>)((a) =>
            {
                res = a;
                return(a + 1);
            });

            context.SetGlobal("test", LuaObject.FromDelegate(func));
            parser = new LuaParser(context, new StringReader("test(123)"));
            parser.Parse();
            Assert.AreEqual(123.0, res);
        }