vm: add batched RegisterInteropFuncs
This commit is contained in:
parent
26e3b6abbe
commit
da2156f955
1 changed files with 9 additions and 0 deletions
|
@ -80,6 +80,15 @@ func (v *VM) RegisterInteropFunc(name string, f InteropFunc, price int) {
|
|||
v.interop[name] = InteropFuncPrice{f, price}
|
||||
}
|
||||
|
||||
// RegisterInteropFuncs will register all interop functions passed in a map in
|
||||
// the VM. Effectively it's a batched version of RegisterInteropFunc.
|
||||
func (v *VM) RegisterInteropFuncs(interops map[string]InteropFuncPrice) {
|
||||
// We allow reregistration here.
|
||||
for name, funPrice := range interops {
|
||||
v.interop[name] = funPrice
|
||||
}
|
||||
}
|
||||
|
||||
// Estack will return the evaluation stack so interop hooks can utilize this.
|
||||
func (v *VM) Estack() *Stack {
|
||||
return v.estack
|
||||
|
|
Loading…
Reference in a new issue