aboutsummaryrefslogtreecommitdiff
path: root/src/lua/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua/common')
-rw-r--r--src/lua/common/Proxy.h12
-rw-r--r--src/lua/common/Reference.hpp12
2 files changed, 23 insertions, 1 deletions
diff --git a/src/lua/common/Proxy.h b/src/lua/common/Proxy.h
index 101fe9c..643dd48 100644
--- a/src/lua/common/Proxy.h
+++ b/src/lua/common/Proxy.h
@@ -27,6 +27,18 @@ namespace lua
}
}
+ void retain()
+ {
+ if (reference != nullptr)
+ reference->retain();
+ }
+
+ void setUserdata(void* data)
+ {
+ if (reference != nullptr)
+ reference->setUserdata(data);
+ }
+
template<class T>
Ref<T>& getRef()
{
diff --git a/src/lua/common/Reference.hpp b/src/lua/common/Reference.hpp
index feb96bb..bd9dc24 100644
--- a/src/lua/common/Reference.hpp
+++ b/src/lua/common/Reference.hpp
@@ -23,6 +23,16 @@ namespace lua
// object type string
const char* const type;
+ void setUserdata(void* data)
+ {
+ userdata = data;
+ }
+
+ void* getUserdata()
+ {
+ return userdata;
+ }
+
protected:
RefBase(void* obj, const char* t)
: count(1)
@@ -39,7 +49,7 @@ namespace lua
void* object;
int count;
-
+ void* userdata;
};
template<class T>