From c9958c9718ea15fba47f59e1b7ab97ea180c70d3 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Tue, 16 Jul 2024 17:52:18 +0300 Subject: [PATCH] add new input.* functions to docs --- doc/en/scripting/user-input.md | 15 +++++++++++++++ doc/ru/scripting/user-input.md | 21 +++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/doc/en/scripting/user-input.md b/doc/en/scripting/user-input.md index b2c6dd6a..422b4279 100644 --- a/doc/en/scripting/user-input.md +++ b/doc/en/scripting/user-input.md @@ -59,3 +59,18 @@ input.get_bindings() -> strings array ``` Returns all binding names. + +```python +input.is_pressed(code: str) -> bool +``` + +Checks input activity using a code consisting of: +- input type: *key* or *mouse* +- input code: [key name](#key names) or mouse button name (left, middle, right) + +Example: +```lua +if (input.is_pressed("key:enter") { + ... +} +``` diff --git a/doc/ru/scripting/user-input.md b/doc/ru/scripting/user-input.md index e113b3b1..422e17bd 100644 --- a/doc/ru/scripting/user-input.md +++ b/doc/ru/scripting/user-input.md @@ -57,3 +57,24 @@ input.get_bindings() -> массив строк ``` Возвращает названия всех доступных привязок. + +```python +input.is_active(bindname: str) -> bool +``` + +Проверяет активность привязки. + +```python +input.is_pressed(code: str) -> bool +``` + +Проверяет активность ввода по коду, состоящему из: +- типа ввода: key (клавиша) или mouse (кнопка мыши) +- код ввода: [имя клавиши](#имена-клавиш) или имя кнопки мыши (left, middle, right) + +Пример: +```lua +if (input.is_pressed("key:enter") { + ... +} +```