mirror of
https://github.com/aseprite/aseprite.git
synced 2024-11-20 14:21:45 +00:00
lua: use the active EngineDelegate::onConsolePrint() in print() function
This is needed to output print() messages in the DevConsoleView when it's open.
This commit is contained in:
parent
b4b232b10f
commit
aed23f4751
@ -52,10 +52,8 @@ int print(lua_State* L)
|
||||
lua_pop(L, 1); // pop result
|
||||
}
|
||||
if (!output.empty()) {
|
||||
std::printf("%s\n", output.c_str());
|
||||
std::fflush(stdout);
|
||||
if (App::instance()->isGui())
|
||||
Console().printf("%s\n", output.c_str());
|
||||
App::instance()->scriptEngine()
|
||||
->consolePrint(output.c_str());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -291,8 +289,10 @@ void Engine::onConsolePrint(const char* text)
|
||||
{
|
||||
if (m_delegate)
|
||||
m_delegate->onConsolePrint(text);
|
||||
else
|
||||
else {
|
||||
std::printf("%s\n", text);
|
||||
std::fflush(stdout);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace script
|
||||
|
@ -58,6 +58,10 @@ namespace app {
|
||||
const std::string& filename = std::string());
|
||||
bool evalFile(const std::string& filename);
|
||||
|
||||
void consolePrint(const char* text) {
|
||||
onConsolePrint(text);
|
||||
}
|
||||
|
||||
private:
|
||||
void onConsolePrint(const char* text);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user