Closed dementcore closed 1 year ago
Hi @dementcore,
Module exports are only accessible via the import mechanism. However, a module can add properties to globalThis
:
engine.AddHostType(typeof(Console));
engine.Execute(new DocumentInfo { Category = ModuleCategory.Standard }, @"
globalThis.main = function () {
Console.WriteLine('Hello, world!');
}
");
engine.Script.main();
Good luck!
Thank you very much! Works like a charm!
Regards
Hi again @ClearScriptLib and sorry for inconveniences!!
When a script is evaluated or executed as a module. How can i call a script method from host code?
Example code:
Note: I need that the script be a module because it's needed to import another modules in it, so evaluate as a regular script is not possible for the requeriments i have.
Thanks!
Best regards