Exemplo n.º 1
0
        static void Main(string [] args)
        {
            using (Lua lua = new Lua())
             		{
             lua.DebugHook += DebugHook;
             lua.SetDebugHook (NLua.Event.EventMasks.LUA_MASKLINE, 0);
             var a = new System.Numerics.Complex (10, 0);
             var b = new System.Numerics.Complex (0, 3);
             var x = a + b;

            // lua.LoadCLRPackage ();
             lua ["a"] = a;
             lua ["b"] = 1;
             var res = lua.DoString (@"return a + b")[0];

             		}
        }
Exemplo n.º 2
0
		public void TestDebugHook ()
		{
			int [] lines = { 1, 2, 1, 3 };
			int line = 0;

			using (Lua lua = new Lua ()) {
				lua.DebugHook += (sender,args) => {
					Assert.AreEqual (args.LuaDebug.currentline,lines [line]);
					line ++;
				};
				lua.SetDebugHook (NLua.Event.EventMasks.LUA_MASKLINE, 0);

				lua.DoString (@"function testing_hooks() return 10 end
							val = testing_hooks() 
							val = val + 1");
			}
		}