mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-04-04 14:56:04 +00:00
First working console
This commit is contained in:
@@ -57,8 +57,16 @@ TConsole::TConsole() {
|
||||
Application::GracefullyShutdown();
|
||||
} else if (cmd == "clear" || cmd == "cls") {
|
||||
// TODO: clear screen
|
||||
mLuaEngine.EnqueueScript(mStateId, std::make_shared<std::string>(cmd));
|
||||
} 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) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
}
|
||||
mCommandline.write("Result ready.");
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -75,4 +83,5 @@ void TConsole::WriteRaw(const std::string& str) {
|
||||
|
||||
void TConsole::InitializeLuaConsole(TLuaEngine& Engine) {
|
||||
Engine.EnsureStateExists(mStateId, "<>");
|
||||
mLuaEngine = &Engine;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user