Skip to content

Commit 9de3a96

Browse files
committed
Load lua library for debugging in dev mode
1 parent abd8c12 commit 9de3a96

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Launcher.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,13 @@ bool InsertLaunchLua(std::vector<std::wstring> &commandLine, std::string &firstL
247247
return false;
248248
}
249249

250+
bool isDevScript(std::wstring scriptPath) {
251+
int finalSlash = scriptPath.find_last_of('\\');
252+
std::wstring folderName = scriptPath.substr(0, finalSlash).substr(scriptPath.substr(0, finalSlash).find_last_of(L'\\') + 1);
253+
wprintf(L"Folder: %s", folderName);
254+
return folderName == L"src";
255+
}
256+
250257
std::vector<std::string> ConvertToACP(std::vector<std::wstring> commandLine)
251258
{
252259
std::vector<std::string> commandLineACP;
@@ -303,6 +310,10 @@ int CALLBACK wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance
303310
dllName += L".dll";
304311
}
305312

313+
if (isDevScript(commandLine[1])) {
314+
LoadLibrary(L"lua51.dll");
315+
}
316+
306317
// Load the DLL
307318
HMODULE hDLL = LoadLibrary(dllName.c_str());
308319
if (hDLL == nullptr)

0 commit comments

Comments
 (0)