summaryrefslogtreecommitdiff
path: root/script/vm/list.lua
diff options
context:
space:
mode:
Diffstat (limited to 'script/vm/list.lua')
-rw-r--r--script/vm/list.lua30
1 files changed, 30 insertions, 0 deletions
diff --git a/script/vm/list.lua b/script/vm/list.lua
new file mode 100644
index 00000000..234f241f
--- /dev/null
+++ b/script/vm/list.lua
@@ -0,0 +1,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,
+}