private static double ExecuteLuaIntfCompiled(string sScript, int iLoops) { using (LuaInterface.Lua lua = new LuaInterface.Lua()) { lua.RegisterFunction("test", null, typeof(Program).GetMethod("LuaTest")); lua.RegisterFunction("echo", null, typeof(Program).GetMethod("LuaEcho")); LuaInterface.LuaFunction f = lua.LoadString(sScript, "test"); Stopwatch sw = new Stopwatch(); sw.Start(); for (int i = 0; i < iLoops; i++) { DebugOut("LuaIntf-C", i, f.Call()); } return(sw.ElapsedMilliseconds / (double)iLoops); } }
private static double ExecuteLuaIntfCompiled(string sScript, int iLoops) { using (LuaInterface.Lua lua = new LuaInterface.Lua()) { lua.RegisterFunction("test", null, typeof(Program).GetMethod("LuaTest")); lua.RegisterFunction("echo", null, typeof(Program).GetMethod("LuaEcho")); LuaInterface.LuaFunction f = lua.LoadString(sScript, "test"); Stopwatch sw = new Stopwatch(); sw.Start(); for (int i = 0; i < iLoops; i++) DebugOut("LuaIntf-C", i, f.Call()); return sw.ElapsedMilliseconds / (double)iLoops; } }