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

Function findLoader

load.go:11–30  ·  view source on GitHub ↗
(l *State, name string)

Source from the content-addressed store, hash-verified

9)
10
11func findLoader(l *State, name string) {
12 var msg string
13 if l.Field(UpValueIndex(1), "searchers"); !l.IsTable(3) {
14 Errorf(l, "'package.searchers' must be a table")
15 }
16 for i := 1; ; i++ {
17 if l.RawGetInt(3, i); l.IsNil(-1) {
18 l.Pop(1)
19 l.PushString(msg)
20 Errorf(l, "module '%s' not found: %s", name, msg)
21 }
22 l.PushString(name)
23 if l.Call(1, 2); l.IsFunction(-2) {
24 return
25 } else if l.IsString(-2) {
26 msg += CheckString(l, -2)
27 }
28 l.Pop(2)
29 }
30}
31
32func findFile(l *State, name, field, dirSep string) (string, error) {
33 l.Field(UpValueIndex(1), field)

Callers 1

PackageOpenFunction · 0.85

Calls 12

UpValueIndexFunction · 0.85
ErrorfFunction · 0.85
CheckStringFunction · 0.85
FieldMethod · 0.80
IsTableMethod · 0.80
RawGetIntMethod · 0.80
IsNilMethod · 0.80
PopMethod · 0.80
PushStringMethod · 0.80
CallMethod · 0.80
IsFunctionMethod · 0.80
IsStringMethod · 0.80

Tested by

no test coverage detected