Esempio n. 1
0
		public void Execute(ShellContext context, string arguments)
		{
			if (m_Debugger == null)
			{
				m_Debugger = new RemoteDebuggerService();
				m_Debugger.Attach(context.Script, "MoonSharp REPL interpreter", false);
				Process.Start(m_Debugger.HttpUrlStringLocalHost);
			}
		}
Esempio n. 2
0
		private void ActivateRemoteDebugger(Script script)
		{
			if (remoteDebugger == null)
			{
				remoteDebugger = new RemoteDebuggerService();

				// the last boolean is to specify if the script is free to run 
				// after attachment, defaults to false
				remoteDebugger.Attach(script, "Description of the script", false);
			}

			// start the web-browser at the correct url. Replace this or just
			// pass the url to the user in some way.
			Process.Start(remoteDebugger.HttpUrlStringLocalHost);
		}
Esempio n. 3
0
		static void Main(string[] args)
		{
			Script S = new Script(CoreModules.Basic);

			RemoteDebuggerService remoteDebugger;

			remoteDebugger = new RemoteDebuggerService();
		
			remoteDebugger.Attach(S, "MyScript", false);

			Process.Start(remoteDebugger.HttpUrlStringLocalHost);
	
			S.DoString(@"

local hi = 'hello'

local function test()
    print(hi)
end

test();

hi = 'X'

test();

local hi = '!';

test();




");

			Console.WriteLine("DONE");

			Console.ReadKey();
		}
Esempio n. 4
0
		private static void ParseCommand(Script S, string p)
		{
			if (p == "help")
			{
				Console.WriteLine("Type Lua code to execute Lua code, multilines are accepted, ");
				Console.WriteLine("or type one of the following commands to execute them.");
				Console.WriteLine("");
				Console.WriteLine("Commands:");
				Console.WriteLine("");
				Console.WriteLine("	!exit - Exits the interpreter");
				Console.WriteLine("	!debug - Starts the debugger");
				Console.WriteLine("	!run <filename> - Executes the specified Lua script");
				Console.WriteLine("	!compile <filename> - Compiles the file in a binary format");
				Console.WriteLine("");
			}
			else if (p == "exit")
			{
				Environment.Exit(0);
			}
			else if (p == "debug" && m_Debugger == null)
			{
				m_Debugger = new RemoteDebuggerService();
				m_Debugger.Attach(S, "MoonSharp REPL interpreter", false);
				Process.Start(m_Debugger.HttpUrlStringLocalHost);
			}
			else if (p.StartsWith("run"))
			{
				p = p.Substring(3).Trim();
				S.DoFile(p);
			}
			else if (p == "!")
			{
				ParseCommand(S, "debug");
				ParseCommand(S, @"run c:\temp\test.lua");
			}
			else if (p.StartsWith("compile"))
			{
				p = p.Substring("compile".Length).Trim();

				string targetFileName = p + "-compiled";

				DynValue chunk = S.LoadFile(p);

				using (Stream stream = new FileStream(targetFileName, FileMode.Create, FileAccess.Write))
					S.Dump(chunk, stream);
			}
		}
Esempio n. 5
0
        protected virtual void ActivateRemoteDebugger(Script script)
        {
            #if UNITY_STANDALONE
            if (remoteDebuggerService == null)
            {
                remoteDebuggerService = new RemoteDebuggerService();

                // the last boolean is to specify if the script is free to run 
                // after attachment, defaults to false
                remoteDebuggerService.Attach(script, gameObject.name, false);
            }

            // start the web-browser at the correct url. Replace this or just
            // pass the url to the user in some way.
            Process.Start(remoteDebuggerService.HttpUrlStringLocalHost);
            #endif
        }