(l *State, name string)
| 9 | ) |
| 10 | |
| 11 | func 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 | |
| 32 | func findFile(l *State, name, field, dirSep string) (string, error) { |
| 33 | l.Field(UpValueIndex(1), field) |
no test coverage detected