MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / luaL_where

Function luaL_where

lua/lauxlib.c:95–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93
94
95LUALIB_API void luaL_where (lua_State *L, int level) {
96 lua_Debug ar;
97 if (lua_getstack(L, level, &ar)) { /* check function at level */
98 lua_getinfo(L, "Sl", &ar); /* get info about it */
99 if (ar.currentline > 0) { /* is there info? */
100 const char *src;
101 ptrdiff_t srclen;
102 if (get_src_at_line(ar.source, ar.currentline, &src, &srclen) == 0) {
103 if (srclen > 31) srclen = 31;
104 char line[srclen + 1];
105 memcpy(line, src, srclen);
106 line[srclen] = 0;
107 lua_pushfstring(L, "[%s...]:%d: ", line, ar.currentline);
108 }
109 else
110 lua_pushfstring(L, "%s:%d: ", ar.short_src, ar.currentline);
111 return;
112 }
113 }
114 lua_pushliteral(L, ""); /* else, no information available... */
115}
116
117
118LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) {

Callers 4

luaB_errorFunction · 0.85
luaB_auxwrapFunction · 0.85
luabb_errorFunction · 0.85
luaL_errorFunction · 0.85

Calls 4

lua_getstackFunction · 0.85
lua_getinfoFunction · 0.85
get_src_at_lineFunction · 0.85
lua_pushfstringFunction · 0.85

Tested by

no test coverage detected