This project has moved. For the latest updates, please go here.

Script libraries

Nov 26, 2013 at 2:48 PM
I would like to be able to build and use a lib of helper scripts preferably residing separately (in separate files or storage records).
How can I load or include such scripts in addition to or perhaps from within a main script being executed.
What would be your recommendations.

Yours faithfully,
Nov 26, 2013 at 6:25 PM
Hello MW!

You can execute any number of library scripts to prepare the environment for your main script. There really are no limitations. You can do something simple:
using (var engine = new V8ScriptEngine()) {
    // and so on
Or you can use a module manager such as RequireJS for a bit more structure; see here for a simple RequireJS implementation on ClearScript.

And because ClearScript executes scripts from in-memory strings, you can use whatever storage is convenient - files, resources, database records, etc. You can also construct scripts on the fly in memory.