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

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

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

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

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

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

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

            var context = new LuaContext();

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

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

            var context = new LuaContext();

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

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

            var context = new LuaContext();

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

            parser = new LuaParser(context, "dofile.lua");
            parser.Parse();
        }
Exemple #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);
        }
Exemple #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);
        }