add show_success lua binding (#3249)

This commit is contained in:
kikkin_yo_azzez 2024-06-19 04:37:38 -05:00 committed by GitHub
parent 501182b10c
commit a40f4a4956
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 1 deletions

View File

@ -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.

View File

@ -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<sol::table>();
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;