MCPcopy
hub / github.com/livekit/livekit / NewScriptMatch

Function NewScriptMatch

pkg/clientconfiguration/match.go:37–47  ·  view source on GitHub ↗
(expr string)

Source from the content-addressed store, hash-verified

35}
36
37func NewScriptMatch(expr string) (*ScriptMatch, error) {
38 script := tengo.NewScript(fmt.Appendf(nil, "__res__ := (%s)", expr))
39 if err := script.Add("c", &clientObject{}); err != nil {
40 return nil, err
41 }
42 compiled, err := script.Compile()
43 if err != nil {
44 return nil, err
45 }
46 return &ScriptMatch{compiled}, nil
47}
48
49// use result of eval script expression for match.
50// expression examples:

Callers 3

TestScriptMatchFunction · 0.85
conf.goFile · 0.85

Calls 1

AddMethod · 0.45

Tested by 2

TestScriptMatchFunction · 0.68