MCPcopy Index your code
hub / github.com/Shopify/go-lua / setPath

Function setPath

load.go:114–124  ·  view source on GitHub ↗
(l *State, field, env, def string)

Source from the content-addressed store, hash-verified

112}
113
114func setPath(l *State, field, env, def string) {
115 if path := os.Getenv(env); path == "" || noEnv(l) {
116 l.PushString(def)
117 } else {
118 o := fmt.Sprintf("%c%c", pathListSeparator, pathListSeparator)
119 n := fmt.Sprintf("%c%s%c", pathListSeparator, def, pathListSeparator)
120 path = strings.Replace(path, o, n, -1)
121 l.PushString(path)
122 }
123 l.SetField(-2, field)
124}
125
126var packageLibrary = []RegistryFunction{
127 {"loadlib", func(l *State) int {

Callers 1

PackageOpenFunction · 0.85

Calls 4

noEnvFunction · 0.85
PushStringMethod · 0.80
ReplaceMethod · 0.80
SetFieldMethod · 0.80

Tested by

no test coverage detected