-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLuaVariable.hpp
49 lines (41 loc) · 1.7 KB
/
LuaVariable.hpp
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
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright � 2013 Tom Tondeur
//
// This file is part of LuaLink.
//
// LuaLink is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// LuaLink is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with LuaLink. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include <lua.hpp>
namespace LuaLink
{
template <typename T> class LuaClass;
class LuaVariable
{
public:
template<typename T>
// // Register a variable of type T, will be automatically registered for a class if done so in the appropriate member function
static void Register(T& var, const char* varName);
private:
//LuaScript and LuaClass need to trigger the actual commits to the lua_State
friend class LuaScript;
template<typename T> friend class LuaClass;
// // Commits all registered variables to the lua_State, pass 0 to register as global, otherwise the index on the stack of the table to register variables for
static void Commit(lua_State* pLuaState, int tableIdx = 0);
//Disable default constructor, destructor, copy constructor & assignment operator
LuaVariable(void) = delete;
~LuaVariable(void) = delete;
LuaVariable(const LuaVariable& src) = delete;
LuaVariable& operator=(const LuaVariable& src) = delete;
};
}
#include "LuaVariable.inl"