public (Action tritonAction, Action nluaAction) Benchmark_WriteReference(Triton.Lua triton, NLua.Lua nlua)
        {
            var tritonFunction = triton.CreateFunction("");
            var nluaFunction   = nlua.LoadString("", "test");

            void Triton() => triton["test"] = tritonFunction;
            void NLua() => nlua["test"]     = nluaFunction;

            return(Triton, NLua);
        }
        public (Action tritonAction, Action nluaAction) Benchmark_WriteReference(Triton.Lua triton, NLua.Lua nlua)
        {
            var tritonTable    = triton.CreateTable();
            var nluaTable      = (NLua.LuaTable)nlua.DoString("return {}")[0];
            var tritonFunction = triton.CreateFunction("");
            var nluaFunction   = nlua.LoadString("", "test");

            void Triton() => tritonTable["test"] = tritonFunction;
            void NLua() => nluaTable["test"]     = nluaFunction;

            return(Triton, NLua);
        }
Exemple #3
0
        public (Action tritonAction, Action nluaAction) Benchmark_UnaryOperator(Triton.Lua triton, NLua.Lua nlua)
        {
            triton["c"] = new Complex(1, 1);
            nlua["c"]   = new Complex(1, 1);
            var tritonFunction = triton.CreateFunction("x = -c");
            var nluaFunction   = nlua.LoadString("x = -c", "test");

            void Triton() => tritonFunction.Call();
            void NLua() => nluaFunction.Call();

            return(Triton, NLua);
        }
        public (Action tritonAction, Action nluaAction) Benchmark_WriteStatic(Triton.Lua triton, NLua.Lua nlua)
        {
            triton.ImportType(typeof(TestClass));
            nlua.DoString("TestClass = luanet.import_type('Triton.Benchmarks.Binding.FieldBenchmark+TestClass')");
            var tritonFunction = triton.CreateFunction("TestClass.X = 0");
            var nluaFunction   = nlua.LoadString("TestClass.X = 0", "test");

            void Triton() => tritonFunction.Call();
            void NLua() => nluaFunction.Call();

            return(Triton, NLua);
        }
        public (Action tritonAction, Action nluaAction) Benchmark_WriteInstance(Triton.Lua triton, NLua.Lua nlua)
        {
            triton["test"] = new TestClass();
            nlua["test"]   = new TestClass();
            var tritonFunction = triton.CreateFunction("test.x = 0");
            var nluaFunction   = nlua.LoadString("test.x = 0", "test");

            void Triton() => tritonFunction.Call();
            void NLua() => nluaFunction.Call();

            return(Triton, NLua);
        }
Exemple #6
0
        public (Action tritonAction, Action nluaAction) Benchmark_CallInstance_Results(Triton.Lua triton, NLua.Lua nlua)
        {
            triton["test"] = new TestClass();
            nlua["test"]   = new TestClass();
            var tritonFunction = triton.CreateFunction("x, y = test:y2()");
            var nluaFunction   = nlua.LoadString("x, y = test:y2()", "test");

            void Triton() => tritonFunction.Call();
            void NLua() => nluaFunction.Call();

            return(Triton, NLua);
        }
Exemple #7
0
 private void TextBoxLuaCode_TextChanged(object sender, EventArgs e)
 {
     try
     {
         luaEngine.LoadString(Encoding.UTF8.GetBytes(textBoxLuaCode.Text), "textbox");
         labelLuaError.Text = "";
     }
     catch (LuaScriptException ex)
     {
         labelLuaError.Text = ex.Message;
     }
 }
Exemple #8
0
        public (Action tritonAction, Action nluaAction) Benchmark_Write(Triton.Lua triton, NLua.Lua nlua)
        {
            triton["test"] = new int[10];
            nlua["test"]   = new int[10];
            var tritonFunction = triton.CreateFunction("test[0] = 10");
            var nluaFunction   = nlua.LoadString("test[0] = 10", "test");

            void Triton() => tritonFunction.Call();
            void NLua() => nluaFunction.Call();

            return(Triton, NLua);
        }
        public (Action tritonAction, Action nluaAction) Benchmark_ReadReference(Triton.Lua triton, NLua.Lua nlua)
        {
            var tritonTable = triton.CreateTable();
            var nluaTable   = (NLua.LuaTable)nlua.DoString("return {}")[0];

            tritonTable["test"] = triton.CreateFunction("");
            nluaTable["test"]   = nlua.LoadString("", "test");

            void Triton()
            {
                var t = tritonTable["test"];
            }

            void NLua()
            {
                var t = nluaTable["test"];
            }

            return(Triton, NLua);
        }
Exemple #10
0
 public void LoadString(string str)
 {
     lua.LoadString(str, "Check");
 }