Hello Querty,
Suppose you have a class that provides sensitive host functionality:
Here's how you might create a script library that uses that class without exposing it to other script code:
With this setup, additional script code (such as the plugin code) can invoke the "elevated" library (e.g.,
Good luck!
Suppose you have a class that provides sensitive host functionality:
publicclass HostLib { publicvoid Log(string message) { Console.WriteLine(message); } }
dynamic createScriptLib = engine.Evaluate(@" (function (hostLib) { return { log: function (message) { hostLib.Log(message); } }; }).valueOf() "); engine.Script.lib = createScriptLib(new HostLib());
lib.log('Hello, world!')
), but it has no access to the host object that provides the underlying functionality.Good luck!