aboutsummaryrefslogtreecommitdiff
path: root/docs/api/shmem.lua
blob: d9d85c8d0e8822239f4f87e34a3dc9951ae708e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---@meta

---
---Functionality that allows to share data between processes.
---@class shmem
shmem = {}

---
---Open a shared memory container.
---
---@param namespace string
---@param capacity integer
---
---@return shmem | nil
---@return string errmsg
function shmem.open(namespace, capacity) end

---
---Adds or edits an existing element on the shared memory container.
---
---@param name string
---@param value string
---
---@return boolean updated
function shmem:set(name, value) end

---
---Retrieve the element data from the shared memory container.
---
---@param name_or_index string|integer
---
---@return string? data
function shmem:get(name_or_index) end

---
---Removes the specified element from the shared memory container.
---
---@param name string
function shmem:remove(name) end

---
---Remove all elements from the shared memory container.
---
function shmem:clear() end

---
---The amount of elements residing on the shared memory container.
---
---@return integer
function shmem:size() end

---
---Maximum amount of elements the shared memory container can store.
---
---@return integer
function shmem:capacity() end

---
---Implements the pairs metamethod for easy traversal of elements.
---
---@return function
function shmem:__pairs() end


return shmem