MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / GetFunction

Method GetFunction

internal/scripting/vmwrapper.go:29–45  ·  view source on GitHub ↗
(name string)

Source from the content-addressed store, hash-verified

27}
28
29func (vmw *VMWrapper) GetFunction(name string) (goja.Callable, bool) {
30
31 fn, ok := vmw.callableCache[name]
32
33 if ok {
34 return fn, fn != nil
35 }
36
37 fn, ok = goja.AssertFunction(vmw.VM.Get(name))
38
39 if vmw.maxCacheSize == 0 || vmw.cacheSize < vmw.maxCacheSize {
40 vmw.cacheSize++
41 vmw.callableCache[name] = fn
42 }
43
44 return fn, ok
45}
46
47// loadVM compiles and runs script source in a new Goja VM, returning a ready
48// VMWrapper. scriptLabel is used in compile error messages (e.g. "room-42").

Callers 15

TrySpellScriptEventFunction · 0.80
TryRoomScriptEventFunction · 0.80
TryRoomTryEnterEventFunction · 0.80
TryRoomTryExitEventFunction · 0.80
TryRoomIdleEventFunction · 0.80
TryRoomCommandFunction · 0.80
TryItemScriptEventFunction · 0.80
TryItemCommandFunction · 0.80

Calls 1

GetMethod · 0.45