aboutsummaryrefslogtreecommitdiff
path: root/src/lanes.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lanes.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/lanes.cpp b/src/lanes.cpp
index f32e7af..87f9a90 100644
--- a/src/lanes.cpp
+++ b/src/lanes.cpp
@@ -356,24 +356,20 @@ LUAG_FUNC(lane_new)
356 // store the uservalue in the Lane full userdata 356 // store the uservalue in the Lane full userdata
357 lua_setiuservalue(L, StackIndex{ -2 }, UserValueIndex{ 1 }); // L: ... lane 357 lua_setiuservalue(L, StackIndex{ -2 }, UserValueIndex{ 1 }); // L: ... lane
358 358
359 lua_State* const _L2{ lane->L };
360 STACK_CHECK_START_REL(_L2, 0);
361 StackIndex const _name_idx{ lua_isnoneornil(L, kNameIdx) ? kIdxNone : kNameIdx }; 359 StackIndex const _name_idx{ lua_isnoneornil(L, kNameIdx) ? kIdxNone : kNameIdx };
362 std::string_view const _debugName{ (_name_idx > 0) ? luaG_tostring(L, _name_idx) : std::string_view{} }; 360 std::string_view _debugName{ (_name_idx > 0) ? luaG_tostring(L, _name_idx) : std::string_view{} };
363 if (!_debugName.empty()) 361 if (!_debugName.empty())
364 { 362 {
365 if (_debugName != "auto") { 363 if (_debugName == "auto") {
366 luaG_pushstring(_L2, _debugName); // L: ... lane L2: "<name>"
367 } else {
368 lua_Debug _ar; 364 lua_Debug _ar;
369 lua_pushvalue(L, kFuncIdx); // L: ... lane func 365 lua_pushvalue(L, kFuncIdx); // L: ... lane func
370 lua_getinfo(L, ">S", &_ar); // L: ... lane 366 lua_getinfo(L, ">S", &_ar); // L: ... lane
371 luaG_pushstring(_L2, "%s:%d", _ar.short_src, _ar.linedefined); // L: ... lane L2: "<name>" 367 luaG_pushstring(L, "%s:%d", _ar.short_src, _ar.linedefined); // L: ... lane "<name>"
368 lua_replace(L, _name_idx); // L: ... lane
369 _debugName = luaG_tostring(L, _name_idx);
372 } 370 }
373 lane->changeDebugName(kIdxTop); 371 lane->storeDebugName(_debugName);
374 lua_pop(_L2, 1); // L: ... lane L2:
375 } 372 }
376 STACK_CHECK(_L2, 0);
377 STACK_CHECK(L, 1); 373 STACK_CHECK(L, 1);
378 } 374 }
379 375