(l *State)
| 134 | } |
| 135 | |
| 136 | func readLine(l *State) int { |
| 137 | s := l.ToUserData(UpValueIndex(1)).(*stream) |
| 138 | argCount, _ := l.ToInteger(UpValueIndex(2)) |
| 139 | if s.close == nil { |
| 140 | Errorf(l, "file is already closed") |
| 141 | } |
| 142 | l.SetTop(1) |
| 143 | for i := 1; i <= argCount; i++ { |
| 144 | l.PushValue(UpValueIndex(3 + i)) |
| 145 | } |
| 146 | resultCount := read(l, s.f, 2) |
| 147 | l.assert(resultCount > 0) |
| 148 | if !l.IsNil(-resultCount) { |
| 149 | return resultCount |
| 150 | } |
| 151 | if resultCount > 1 { |
| 152 | m, _ := l.ToString(-resultCount + 1) |
| 153 | Errorf(l, m) |
| 154 | } |
| 155 | if l.ToBoolean(UpValueIndex(3)) { |
| 156 | l.SetTop(0) |
| 157 | l.PushValue(UpValueIndex(1)) |
| 158 | closeHelper(l) |
| 159 | } |
| 160 | return 0 |
| 161 | } |
| 162 | |
| 163 | func lines(l *State, shouldClose bool) { |
| 164 | argCount := l.Top() - 1 |
nothing calls this directly
no test coverage detected