(L *LState)
| 168 | } |
| 169 | |
| 170 | func baseLoad(L *LState) int { |
| 171 | fn := L.CheckFunction(1) |
| 172 | chunkname := L.OptString(2, "?") |
| 173 | top := L.GetTop() |
| 174 | buf := []string{} |
| 175 | for { |
| 176 | L.SetTop(top) |
| 177 | L.Push(fn) |
| 178 | L.Call(0, 1) |
| 179 | ret := L.reg.Pop() |
| 180 | if ret == LNil { |
| 181 | break |
| 182 | } else if LVCanConvToString(ret) { |
| 183 | str := ret.String() |
| 184 | if len(str) > 0 { |
| 185 | buf = append(buf, string(str)) |
| 186 | } else { |
| 187 | break |
| 188 | } |
| 189 | } else { |
| 190 | L.Push(LNil) |
| 191 | L.Push(LString("reader function must return a string")) |
| 192 | return 2 |
| 193 | } |
| 194 | } |
| 195 | return loadaux(L, strings.NewReader(strings.Join(buf, "")), chunkname) |
| 196 | } |
| 197 | |
| 198 | func baseLoadFile(L *LState) int { |
| 199 | var reader io.Reader |
nothing calls this directly
no test coverage detected
searching dependent graphs…