MCPcopy Create free account
hub / github.com/Norbyte/bg3se / FindLuaSourcePath

Function FindLuaSourcePath

BG3Extender/Lua/Debugger/LuaDebugMessages.cpp:75–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73bool LuaIsUserFunction(lua_State* L, CallInfo* ci);
74
75std::optional<STDString> FindLuaSourcePath(STDString const& name)
76{
77 if (name.starts_with("builtin://") && !gExtender->GetConfig().LuaBuiltinResourceDirectory.empty()) {
78 return ToUTF8(gExtender->GetConfig().LuaBuiltinResourceDirectory) + "/" + name.substr(10);
79 }
80
81 if (gExtender->GetServer().HasExtensionState()) {
82 auto const& files = gExtender->GetServer().GetExtensionState().GetLoadedFileFullPaths();
83 auto it = files.find(name);
84 if (it != files.end()) {
85 return it->second;
86 }
87 }
88
89 if (gExtender->GetClient().HasExtensionState()) {
90 auto const& files = gExtender->GetClient().GetExtensionState().GetLoadedFileFullPaths();
91 auto it = files.find(name);
92 if (it != files.end()) {
93 return it->second;
94 }
95 }
96
97 return {};
98}
99
100void DebugMessageHandler::SendBreakpointTriggered(DbgContext context, BkBreakpointTriggered_Reason reason,
101 lua_State* L, char const* message)

Callers 2

HandleRequestSourceMethod · 0.85

Calls 8

GetServerMethod · 0.80
GetExtensionStateMethod · 0.80
GetClientMethod · 0.80
ToUTF8Function · 0.50
emptyMethod · 0.45
HasExtensionStateMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected