summaryrefslogtreecommitdiffstats
path: root/source/squirrelbindings/SquirrelArray.h
diff options
context:
space:
mode:
authorlapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-07-09 17:53:17 +0200
committerlapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-07-09 17:53:17 +0200
commitd82e2449a0282232c6e6acd1a84514ee5332f4db (patch)
tree6935f3cd4a9d3050b1aed8b1b0f9514f5fcff17f /source/squirrelbindings/SquirrelArray.h
parentSorry... (diff)
downloadcuberite-d82e2449a0282232c6e6acd1a84514ee5332f4db.tar
cuberite-d82e2449a0282232c6e6acd1a84514ee5332f4db.tar.gz
cuberite-d82e2449a0282232c6e6acd1a84514ee5332f4db.tar.bz2
cuberite-d82e2449a0282232c6e6acd1a84514ee5332f4db.tar.lz
cuberite-d82e2449a0282232c6e6acd1a84514ee5332f4db.tar.xz
cuberite-d82e2449a0282232c6e6acd1a84514ee5332f4db.tar.zst
cuberite-d82e2449a0282232c6e6acd1a84514ee5332f4db.zip
Diffstat (limited to '')
-rw-r--r--source/squirrelbindings/SquirrelArray.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/source/squirrelbindings/SquirrelArray.h b/source/squirrelbindings/SquirrelArray.h
new file mode 100644
index 000000000..0c2e34f7f
--- /dev/null
+++ b/source/squirrelbindings/SquirrelArray.h
@@ -0,0 +1,36 @@
+#pragma once
+#include <string>
+
+template <typename T>
+class SquirrelArray
+{
+public:
+ SquirrelArray()
+ {
+ }
+
+ unsigned int Size()
+ {
+ return m_Values.size();
+ }
+
+ T Get(unsigned int a_Index)
+ {
+ if(m_Values.size() < a_Index)
+ {
+ return T();
+ }
+ return m_Values.at(a_Index);
+ }
+
+ void Add(T a_Value)
+ {
+ m_Values.push_back(a_Value);
+ }
+
+protected:
+ std::vector<T> m_Values;
+
+};
+
+class SquirrelStringArray : public SquirrelArray<std::string> { }; \ No newline at end of file