Documentation ¶
Overview ¶
Package d2script provides a virtual machine for interpretting scripts
Index ¶
- type ScriptEngine
- func (s *ScriptEngine) AddFunction(name string, value interface{})
- func (s *ScriptEngine) AllowEval()
- func (s *ScriptEngine) DisallowEval()
- func (s *ScriptEngine) Eval(code string) (string, error)
- func (s *ScriptEngine) RunScript(fileName string) (*otto.Value, error)
- func (s *ScriptEngine) ToValue(source interface{}) (otto.Value, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ScriptEngine ¶
type ScriptEngine struct {
// contains filtered or unexported fields
}
ScriptEngine allows running JavaScript scripts
func CreateScriptEngine ¶
func CreateScriptEngine() *ScriptEngine
CreateScriptEngine creates the script engine and returns a pointer to it.
func (*ScriptEngine) AddFunction ¶
func (s *ScriptEngine) AddFunction(name string, value interface{})
AddFunction adds the given function to the script engine with the given name.
func (*ScriptEngine) AllowEval ¶
func (s *ScriptEngine) AllowEval()
AllowEval allows the evaluation of JS code.
func (*ScriptEngine) DisallowEval ¶
func (s *ScriptEngine) DisallowEval()
DisallowEval disallows the evaluation of JS code.
Click to show internal directories.
Click to hide internal directories.