update doc/*/scripting/user-input.md

This commit is contained in:
MihailRis
2025-01-07 22:40:46 +03:00
parent df9c301f58
commit 0d17396fe8
2 changed files with 20 additions and 0 deletions
+10
View File
@@ -57,6 +57,16 @@ input.add_callback("key:space", function ()
end)
```
You can also bind the function lifetime to the UI container instead of the HUD.
In that case, `input.add_callback` may be used until the `on_hud_open` is called.
```lua
input.add_callback("key:escape", function ()
print("NO")
return true -- prevents previously assigned functions from being called
end, document.root)
```
```python
input.get_mouse_pos() -> {int, int}
```