Update docs/dev/Lua API.rst

Co-authored-by: Myk <myk.taylor@gmail.com>
develop
shevernitskiy 2023-08-30 12:48:26 +03:00 committed by GitHub
parent 7ce7bd15f6
commit b3d423b8a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

@ -2603,8 +2603,9 @@ Textures module
In order for the game to render a particular tile (graphic), it needs to know the
``texpos`` - the position in the vector of the registered game textures (also the
graphical tile id passed as the ``tile`` field in a `Pen <lua-screen-pen>`).
Add your own texture to it and get ``texpos`` is not difficult. But the game periodically deletes textures that are in the vector, and that's the problem.
Because the ``texpos`` we got earlier no longer points to our added texture.
Adding new textures to the vector is not difficult, but the game periodically
deletes textures that are in the vector, and that's a problem since it
invalidates the ``texpos`` value that used to point to that texture.
The ``texture`` module solves this problem. Instead of ``texpos`` directly, it operates on the ``TexposHandle`` entity, which is essentially a reference to ``texpos``.
Thanks to this handle, it is possible to get a valid ``texpos`` at any time.