Types
NimScriptFile = distinct string
- Distinct to load from string Source Edit
NimScriptPath = distinct string
- Distinct to load from path Source Edit
VMErrorHook = proc (config: ConfigRef; info: TLineInfo; msg: string; severity: Severity) {....gcsafe.}
- Source Edit
VmProcNotFound = object of CatchableError
- Source Edit
VmSymNotFound = object of CatchableError
- Source Edit
Procs
proc getGlobalVariable[T](intr: Option[Interpreter] or Interpreter; name: string): T
- Easy access of a global nimscript variable Source Edit
proc loadScript(script: NimScriptFile or NimScriptPath; addins: VMAddins = VMAddins(); modules: varargs[string]; vmErrorHook = errorHook; stdPath = findNimStdlibCompileTime(); searchPaths: sink seq[string] = @[]; defines = defaultDefines): Option[ Interpreter]
- Loads an interpreter from a file or from string, with given addtions and userprocs. To load from the filesystem use NimScriptPath(yourPath). To load from a string use NimScriptFile(yourFile). addins is the overrided procs/addons from impleNimScriptModule `modules implict imports to add to the module. stdPath to use shipped path instead of finding it at compile time. vmErrorHook a callback which should raise VmQuit, refer to errorHook for reference. searchPaths optional paths one can use to supply libraries or packages for the Source Edit
proc loadScriptWithState(intr: var Option[Interpreter]; script: NimScriptFile or NimScriptPath; addins: VMAddins = VMAddins(); modules: varargs[string]; vmErrorHook = errorHook; stdPath = findNimStdlibCompileTime(); searchPaths: sink seq[string] = @[]; defines = defaultDefines)
- Same as loadScript, but saves state, then loads the intepreter into intr. This does not keep a working intepreter if there is a script error. Source Edit
proc safeloadScriptWithState(intr: var Option[Interpreter]; script: NimScriptFile or NimScriptPath; addins: VMAddins = VMAddins(); modules: varargs[string]; vmErrorHook = errorHook; stdPath = findNimStdlibCompileTime(); searchPaths: sink seq[string] = @[]; defines = defaultDefines)
- Same as loadScriptWithState but saves state then loads the intepreter into intr if there were no script errors. Tries to keep the interpreter running. Source Edit
Macros
macro invokeDynamic(intr: Interpreter; pName: string; args: varargs[typed]; returnType: typedesc = void): untyped
- Calls a nimscript function named pName, passing the args Converts the returned value to returnType Source Edit