Add plugin API for showing an error message (#11706)

This commit is contained in:
Ted John authored and GitHub committed 2020-05-10 14:06:31 -03:00
1 parent 5288caec02
commit ec06a9ca4b
2 files changed
+13

No files matched your search

+7
View File
@@ -945,6 +945,13 @@ declare global {
closeWindows(classification: string, id?: number): void;
closeAllWindows(): void;
/**
* Show a red error box.
* @param title The title / first line of the box.
* @param message The message / second line of the box.
*/
showError(title: string, message: string): void;
/**
* Shows a text input prompt and calls the given callback when entered.
* @param desc The parameters for the text input window.
+6
View File
@@ -181,6 +181,11 @@ namespace OpenRCT2::Scripting
return {};
}
void showError(const std::string& title, const std::string& message)
{
window_error_open(title, message);
}
void showTextInput(const DukValue& desc)
{
try
@@ -230,6 +235,7 @@ namespace OpenRCT2::Scripting
dukglue_register_method(ctx, &ScUi::closeWindows, "closeWindows");
dukglue_register_method(ctx, &ScUi::closeAllWindows, "closeAllWindows");
dukglue_register_method(ctx, &ScUi::getWindow, "getWindow");
dukglue_register_method(ctx, &ScUi::showError, "showError");
dukglue_register_method(ctx, &ScUi::showTextInput, "showTextInput");
dukglue_register_method(ctx, &ScUi::activateTool, "activateTool");
dukglue_register_method(ctx, &ScUi::registerMenuItem, "registerMenuItem");