summaryrefslogtreecommitdiff
path: root/server/src/vm/list.lua
blob: 234f241f094274c0dab04f32604411e00dec37c5 (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
local Id = 0
local Version = 0
local List = {}

local function get(id)
    return List[id]
end

local function add(obj)
    Id = Id + 1
    List[Id] = obj
    return Id
end

local function clear(id)
    List[id] = nil
    Version = Version + 1
end

local function getVersion()
    return Version
end

return {
    get = get,
    add = add,
    clear = clear,
    list = List,
    getVersion = getVersion,
}