diff --git a/docs/lua/tables/gui.md b/docs/lua/tables/gui.md index fba9a7f7..4197c928 100644 --- a/docs/lua/tables/gui.md +++ b/docs/lua/tables/gui.md @@ -2,7 +2,7 @@ Table containing functions for modifying the menu GUI. -## Functions (7) +## Functions (8) ### `get_tab(tab_name)` @@ -30,6 +30,19 @@ tab = gui.get_tab(tab_name) tab = gui.add_tab(tab_name) ``` +### `show_success(title, message)` + +Shows a success to the user with the given title and message. + +- **Parameters:** + - `title` (string) + - `message` (string) + +**Example Usage:** +```lua +gui.show_success(title, message) +``` + ### `show_message(title, message)` Shows a message to the user with the given title and message. diff --git a/src/lua/bindings/gui.cpp b/src/lua/bindings/gui.cpp index 4aa3f270..d95423f6 100644 --- a/src/lua/bindings/gui.cpp +++ b/src/lua/bindings/gui.cpp @@ -243,6 +243,17 @@ namespace lua::gui return new_tab; } + // Lua API: Function + // Table: gui + // Name: show_success + // Param: title: string + // Param: message: string + // Shows a success to the user with the given title and message. + static void show_success(const std::string& title, const std::string& message) + { + big::g_notification_service.push_success(title, message); + } + // Lua API: Function // Table: gui // Name: show_message @@ -317,6 +328,7 @@ namespace lua::gui auto ns = state["gui"].get_or_create(); ns["get_tab"] = get_tab; ns["add_tab"] = add_tab; + ns["show_success"] = show_success; ns["show_message"] = show_message; ns["show_warning"] = show_warning; ns["show_error"] = show_error;