Lua: Fix multiple issues with events

This commit is contained in:
Lion Kortlepel
2021-09-16 14:58:47 +02:00
parent dca573b15c
commit e602decb96
3 changed files with 52 additions and 22 deletions

View File

@@ -58,16 +58,17 @@ TConsole::TConsole() {
} else if (cmd == "clear" || cmd == "cls") {
// TODO: clear screen
} else {
while (!mLuaEngine) {
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
auto Future = mLuaEngine->EnqueueScript(mStateId, std::make_shared<std::string>(cmd));
// wait for it to finish
while (!Future->Ready) {
if (!mLuaEngine) {
beammp_info("Lua not started yet, please try again in a second");
} else {
auto Future = mLuaEngine->EnqueueScript(mStateId, std::make_shared<std::string>(cmd));
// wait for it to finish
/*while (!Future->Ready) {
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
if (Future->Error) {
beammp_error(Future->ErrorMessage);
}*/
}
}
};