diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lanes.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/lanes.cpp b/src/lanes.cpp index 15e04a3..b54f221 100644 --- a/src/lanes.cpp +++ b/src/lanes.cpp | |||
@@ -361,10 +361,17 @@ LUAG_FUNC(lane_new) | |||
361 | if (!_debugName.empty()) | 361 | if (!_debugName.empty()) |
362 | { | 362 | { |
363 | if (_debugName == "auto") { | 363 | if (_debugName == "auto") { |
364 | lua_Debug _ar; | 364 | if (luaG_type(L, kFuncIdx) == LuaType::STRING) { |
365 | lua_pushvalue(L, kFuncIdx); // L: ... lane func | 365 | lua_Debug _ar; |
366 | lua_getinfo(L, ">S", &_ar); // L: ... lane | 366 | lua_getstack(L, 2, &_ar); // 0 is here, 1 is lanes.gen, 2 is its caller |
367 | luaG_pushstring(L, "%s:%d", _ar.short_src, _ar.linedefined); // L: ... lane "<name>" | 367 | lua_getinfo(L, "Sl", &_ar); |
368 | luaG_pushstring(L, "%s:%d", _ar.short_src, _ar.currentline); // L: ... lane "<name>" | ||
369 | } else { | ||
370 | lua_Debug _ar; | ||
371 | lua_pushvalue(L, kFuncIdx); // L: ... lane func | ||
372 | lua_getinfo(L, ">S", &_ar); // L: ... lane | ||
373 | luaG_pushstring(L, "%s:%d", _ar.short_src, _ar.linedefined); // L: ... lane "<name>" | ||
374 | } | ||
368 | lua_replace(L, _name_idx); // L: ... lane | 375 | lua_replace(L, _name_idx); // L: ... lane |
369 | _debugName = luaG_tostring(L, _name_idx); | 376 | _debugName = luaG_tostring(L, _name_idx); |
370 | } | 377 | } |