add gui.confirm(...)
This commit is contained in:
@@ -61,3 +61,21 @@ gui.escape_markup(
|
||||
```
|
||||
|
||||
Escapes markup in text.
|
||||
|
||||
```lua
|
||||
gui.confirm(
|
||||
-- message (does not translate automatically, use gui.str(...))
|
||||
message: str,
|
||||
-- function called upon confirmation
|
||||
on_confirm: function() -> nil,
|
||||
-- function called upon denial/cancellation
|
||||
[optional] on_deny: function() -> nil,
|
||||
-- text for the confirmation button (default: "Yes")
|
||||
-- use an empty string for the default value if you want to specify no_text.
|
||||
[optional] yes_text: str,
|
||||
-- text for the denial button (default: "No")
|
||||
[optional] no_text: str,
|
||||
)
|
||||
```
|
||||
|
||||
Requests confirmation from the user for an action. **Does not** stop code execution.
|
||||
|
||||
@@ -58,3 +58,21 @@ gui.escape_markup(
|
||||
```
|
||||
|
||||
Экранирует разметку в тексте.
|
||||
|
||||
```lua
|
||||
gui.confirm(
|
||||
-- сообщение (не переводится автоматически, используйте gui.str(...))
|
||||
message: str,
|
||||
-- функция, вызываемая при подтвержении
|
||||
on_confirm: function() -> nil,
|
||||
-- функция, вызываемая при отказе/отмене
|
||||
[опционально] on_deny: function() -> nil,
|
||||
-- текст кнопки подтвержения (по-умолчанию: "Да")
|
||||
-- используйте пустую строку для значения по-умолчанию, если нужно указать no_text.
|
||||
[опционально] yes_text: str,
|
||||
-- текст кнопки отказа (по-умолчанию: "Нет")
|
||||
[опционально] no_text: str,
|
||||
)
|
||||
```
|
||||
|
||||
Запрашивает у пользователя подтверждение действия. **Не** останавливает выполнение кода.
|
||||
|
||||
Reference in New Issue
Block a user