From ee8ef0433e36bf354a717bd4af679a0a5af2e6be Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 20 Dec 2018 18:34:50 +0800 Subject: =?UTF-8?q?*=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libjin-lua/common/je_lua_reference.h | 54 ++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/libjin-lua/common/je_lua_reference.h (limited to 'src/libjin-lua/common/je_lua_reference.h') diff --git a/src/libjin-lua/common/je_lua_reference.h b/src/libjin-lua/common/je_lua_reference.h new file mode 100644 index 0000000..1a62dba --- /dev/null +++ b/src/libjin-lua/common/je_lua_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 -- cgit v1.1-26-g67d0