aboutsummaryrefslogtreecommitdiff
path: root/src/libjin-lua/common/l_reference.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-01-14 16:40:14 +0800
committerchai <chaifix@163.com>2019-01-14 16:40:14 +0800
commit98c9825c49a1674f59eafb3253829ca7d5cac3c1 (patch)
treebdd2a6da72fc998ff884b011a2260dc72537c25f /src/libjin-lua/common/l_reference.h
parent8b00d67febf133e89f6a0bfabc41feed555dc4a9 (diff)
*rename source file
Diffstat (limited to 'src/libjin-lua/common/l_reference.h')
-rw-r--r--src/libjin-lua/common/l_reference.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/libjin-lua/common/l_reference.h b/src/libjin-lua/common/l_reference.h
new file mode 100644
index 0000000..1a62dba
--- /dev/null
+++ b/src/libjin-lua/common/l_reference.h
@@ -0,0 +1,54 @@
+#ifndef __JIN_COMMON_REFERENCE_H
+#define __JIN_COMMON_REFERENCE_H
+
+#include "common/je_lua.h"
+
+namespace JinEngine
+{
+ namespace Lua
+ {
+
+ ///
+ /// This class wraps the reference functionality built into Lua, which allows C++ code to refer to Lua
+ /// variables.
+ ///
+ class LuaRef
+ {
+ public:
+ ///
+ ///
+ ///
+ LuaRef(lua_State* L, int i);
+
+ ///
+ ///
+ ///
+ ~LuaRef();
+
+ ///
+ ///
+ ///
+ void unref();
+
+ ///
+ /// Push value onto the stack.
+ ///
+ void push();
+
+ private:
+ ///
+ ///
+ ///
+ lua_State* const mL;
+
+ ///
+ ///
+ ///
+ int mIndex;
+
+ };
+
+ } // namespace Lua
+} // namespace JinEngine
+
+#endif // __JIN_COMMON_REFERENCE_H \ No newline at end of file