summaryrefslogtreecommitdiffstats
path: root/source/LuaItems.h
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-06-13 19:37:23 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-06-13 19:37:23 +0200
commit1c60680fbac2f06823dba123241adc607363a25b (patch)
tree51149ad6910150fd6ffa51ac9ba8d9c6f8ad88fb /source/LuaItems.h
parentModified ToLua additional script to allow multi-usertype virtual functions (diff)
downloadcuberite-1c60680fbac2f06823dba123241adc607363a25b.tar
cuberite-1c60680fbac2f06823dba123241adc607363a25b.tar.gz
cuberite-1c60680fbac2f06823dba123241adc607363a25b.tar.bz2
cuberite-1c60680fbac2f06823dba123241adc607363a25b.tar.lz
cuberite-1c60680fbac2f06823dba123241adc607363a25b.tar.xz
cuberite-1c60680fbac2f06823dba123241adc607363a25b.tar.zst
cuberite-1c60680fbac2f06823dba123241adc607363a25b.zip
Diffstat (limited to '')
-rw-r--r--source/LuaItems.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/source/LuaItems.h b/source/LuaItems.h
new file mode 100644
index 000000000..28ceb0d24
--- /dev/null
+++ b/source/LuaItems.h
@@ -0,0 +1,52 @@
+
+// LuaItems.h
+
+// Interfaces to the cLuaItems class representing a wrapper class that allows Lua to access and manipulate cItems
+
+
+
+
+
+#pragma once
+
+#include "cItem.h"
+
+
+
+
+
+// tolua_begin
+class cLuaItems
+{
+public:
+ // tolua_end
+ // The constructor is not to be Lua-exported, Lua cannot make use of this object
+ cLuaItems(cItems & a_Items) :
+ m_Items(a_Items)
+ {
+ }
+
+ // tolua_begin
+ cItem & Get (int a_Idx) {return m_Items[a_Idx]; }
+ void Set (int a_Idx, const cItem & a_Item) {m_Items[a_Idx] = a_Item; }
+ void Add (const cItem & a_Item) {m_Items.push_back(a_Item); }
+ void Delete(int a_Idx) {m_Items.erase(m_Items.begin() + a_Idx); }
+ void Clear (void) {m_Items.clear(); }
+ int Size (void) {return m_Items.size(); }
+
+ void Add (ENUM_ITEM_ID a_ItemType, char a_ItemCount, short a_ItemHealth)
+ {
+ m_Items.push_back(cItem(a_ItemType, a_ItemCount, a_ItemHealth));
+ }
+
+ void Set (int a_Idx, ENUM_ITEM_ID a_ItemType, char a_ItemCount, short a_ItemHealth)
+ {
+ m_Items[a_Idx] = cItem(a_ItemType, a_ItemCount, a_ItemHealth);
+ }
+protected:
+ cItems & m_Items;
+} ;
+// tolua_end
+
+
+