Esempio n. 1
0
 public void registerFunctionActionTest()
 {
     CSLua.LuaState L = new CSLua.LuaState();
     mTestActionCalled = false;
     L.registerFunction((Action)TestAction);
     L.call("TestAction");
     Assert.IsTrue(mTestActionCalled);
 }
Esempio n. 2
0
 public void registerFunctionActionOneParamTest()
 {
     CSLua.LuaState L = new CSLua.LuaState();
     mTestActionCalled = false;
     L.registerFunction((Action <string>)TestActionOneParam);
     L.call("TestActionOneParam", "This is a param");
     Assert.AreEqual("This is a param", mTestActionOneParamParam);
 }
Esempio n. 3
0
        public void registerFunctionDelegateFuncTest()
        {
            CSLua.LuaState L = new CSLua.LuaState();
            L.registerFunction((Delegate)(Func <double, double>)NOTSquare);
            var result   = L.dostring("return Square(32.623)");
            var expected = 1064.260129;

            Assert.AreEqual(expected, (double)result[0], 0.00001);
        }