aboutsummaryrefslogtreecommitdiff
path: root/src/lua/common/je_lua_reference.h
blob: bde61b6d19ee82003285a12eda8e40f7e56864b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef __JIN_COMMON_REFERENCE_H
#define __JIN_COMMON_REFERENCE_H

#include "../luax.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