Adds print basic command
This commit is contained in:
parent
fb2af879c9
commit
2d6e3335aa
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using Upsilon.Binder;
|
||||
using Upsilon.Evaluator;
|
||||
|
||||
|
@ -22,5 +23,6 @@ namespace Upsilon
|
|||
public EvaluationScope OverrideStaticScope { get; set; } = null;
|
||||
public ScriptLoader ScriptLoader { get; set; } = new ScriptLoader();
|
||||
public ModuleHandler ModuleHandler { get; set; } = new ModuleHandler();
|
||||
public Action<string> PrintResult { get; set; } = Console.WriteLine;
|
||||
}
|
||||
}
|
|
@ -52,6 +52,13 @@ namespace Upsilon.StandardLibraries
|
|||
return new PairsScriptIterator(table);
|
||||
}
|
||||
|
||||
[ScriptFunction("print", "Prints a message to the action given in the script options", passScriptReference: true,
|
||||
directScriptManipulation: true)]
|
||||
public void Print(Script script, ScriptType message)
|
||||
{
|
||||
script.Options.PrintResult.Invoke(message.ToCSharpObject().ToString());
|
||||
}
|
||||
|
||||
[ScriptFunction("require", "Loads a module from the module path, using the given script loader.",
|
||||
true, true)]
|
||||
public ScriptType Require(Script script, ScriptString fileName)
|
||||
|
|
Loading…
Reference in New Issue