MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / GetFile

Method GetFile

emmy_debugger/src/debugger/emmy_debugger.cpp:633–657  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

631}
632
633std::string Debugger::GetFile(lua_Debug *ar) const {
634 if (!currentL) {
635 return "";
636 }
637
638 auto L = currentL;
639
640 const char *file = getDebugSource(ar);
641 if (getDebugCurrentLine(ar) < 0)
642 return file;
643 if (strlen(file) > 0 && file[0] == '@')
644 file++;
645 lua_pushcclosure(L, FixPath, 0);
646 lua_pushstring(L, file);
647 const int result = lua_pcall(L, 1, 1, 0);
648 if (result == LUA_OK) {
649 const auto p = lua_tostring(L, -1);
650 lua_pop(L, 1);
651 if (p) {
652 return p;
653 }
654 }
655 // todo: handle error
656 return file;
657}
658
659void Debugger::HandleBreak() {
660 // to be on the safe side, hook it again

Callers

nothing calls this directly

Calls 5

getDebugSourceFunction · 0.50
getDebugCurrentLineFunction · 0.50
lua_pushcclosureFunction · 0.50
lua_pushstringFunction · 0.50
lua_pcallFunction · 0.50

Tested by

no test coverage detected