Where pushes onto the stack a string identifying the current position of the control at level in the call stack. Typically this string has the following format: chunkname:currentline: Level 0 is the running function, level 1 is the function that called the running function, etc. This function is us
(l *State, level int)
| 188 | // |
| 189 | // This function is used to build a prefix for error messages. |
| 190 | func Where(l *State, level int) { |
| 191 | if f, ok := Stack(l, level); ok { // check function at level |
| 192 | ar, _ := Info(l, "Sl", f) // get info about it |
| 193 | if ar.CurrentLine > 0 { // is there info? |
| 194 | l.PushString(fmt.Sprintf("%s:%d: ", ar.ShortSource, ar.CurrentLine)) |
| 195 | return |
| 196 | } |
| 197 | } |
| 198 | l.PushString("") // else, no information available... |
| 199 | } |
| 200 | |
| 201 | // Errorf raises an error. The error message format is given by format plus |
| 202 | // any extra arguments, following the same rules as PushFString. It also adds |
no test coverage detected