mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add doc/en/scripting/builtins/libsession.md
This commit is contained in:
parent
7caa118fd6
commit
b335201160
1 changed files with 18 additions and 0 deletions
18
doc/en/scripting/builtins/libsession.md
Normal file
18
doc/en/scripting/builtins/libsession.md
Normal file
|
|
@ -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
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue