From b3352011607b10a5945f6c25f6dbc871a00c2db3 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Wed, 18 Mar 2026 22:10:53 +0300 Subject: [PATCH] add doc/en/scripting/builtins/libsession.md --- doc/en/scripting/builtins/libsession.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 doc/en/scripting/builtins/libsession.md diff --git a/doc/en/scripting/builtins/libsession.md b/doc/en/scripting/builtins/libsession.md new file mode 100644 index 000000000..bf2086096 --- /dev/null +++ b/doc/en/scripting/builtins/libsession.md @@ -0,0 +1,18 @@ +# *session* Library + +This library is used to store data that is not reset when loading/unloading content, and is a recommended alternative to using the `_G` table. + +The stored data is not saved when the engine terminates. + +To minimize the risk of name collisions, it is recommended to use pack prefixes (`pack_id:table_name`), or, if a pack stores a single table in *session*, use the pack name as the entry name. + +```lua +-- Returns a table by name. Creates an empty table if it does not exist. +session.get(name: str) -> table + +-- Deletes a table by name. +session.reset(name: str) + +-- Returns true if the table has already been created by calling session.get +session.has(name: str) -> boolean +```