1 //------------------------------------------------------------------------------
3 https://github.com/vinniefalco/LuaBridge
5 Copyright 2016, Robin Gareus <robin@gareus.org>
6 Copyright 2012, Vinnie Falco <vinnie.falco@gmail.com>
7 Copyright 2007, Nathan Reed
9 License: The MIT License (http://www.opensource.org/licenses/mit-license.php)
11 Permission is hereby granted, free of charge, to any person obtaining a copy
12 of this software and associated documentation files (the "Software"), to deal
13 in the Software without restriction, including without limitation the rights
14 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15 copies of the Software, and to permit persons to whom the Software is
16 furnished to do so, subject to the following conditions:
18 The above copyright notice and this permission notice shall be included in all
19 copies or substantial portions of the Software.
21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29 //==============================================================================
31 #ifndef LUABRIDGE_LUABRIDGE_HEADER
32 #define LUABRIDGE_LUABRIDGE_HEADER
34 // All #include dependencies are listed here
35 // instead of in the individual header files.
50 #include <boost/ref.hpp>
51 #include <boost/type_traits.hpp>
52 #include <boost/shared_ptr.hpp>
54 #include "lua/luastate.h"
56 #define LUABRIDGE_MAJOR_VERSION 2
57 #define LUABRIDGE_MINOR_VERSION 0
58 #define LUABRIDGE_VERSION 200
63 // Forward declaration
68 #include "detail/LuaHelpers.h"
70 #include "detail/TypeTraits.h"
71 #include "detail/TypeList.h"
72 #include "detail/FuncTraits.h"
73 #include "detail/Constructor.h"
74 #include "detail/Stack.h"
75 #include "detail/ClassInfo.h"
79 #include "detail/LuaException.h"
80 #include "detail/LuaRef.h"
81 #include "detail/Iterator.h"
82 #include "detail/FuncArgs.h"
84 //------------------------------------------------------------------------------
91 static bool hideMetatables ()
93 return getSettings().hideMetatables;
96 static void setHideMetatables (bool shouldHide)
98 getSettings().hideMetatables = shouldHide;
104 Settings () : hideMetatables (true)
111 static Settings& getSettings ()
113 static Settings settings;
118 //------------------------------------------------------------------------------
124 static bool printBindings ()
126 return getSettings().print_bindings;
129 static void setPrintBindings (bool en)
131 getSettings().print_bindings = en;
137 Settings () : print_bindings (false) { }
141 static Settings& getSettings ()
143 static Settings settings;
149 //------------------------------------------------------------------------------
152 #include "detail/Userdata.h"
153 #include "detail/CFunctions.h"
154 #include "detail/Namespace.h"
156 //------------------------------------------------------------------------------
158 Push an object onto the Lua stack.
161 inline void push (lua_State* L, T t)
163 Stack <T>::push (L, t);
166 //------------------------------------------------------------------------------
168 Set a global value in the lua_State.
170 @note This works on any type specialized by `Stack`, including `LuaRef` and
174 inline void setGlobal (lua_State* L, T t, char const* name)
177 lua_setglobal (L, name);
180 //------------------------------------------------------------------------------
182 Change whether or not metatables are hidden (on by default).
184 inline void setHideMetatables (bool shouldHide)
186 Security::setHideMetatables (shouldHide);
190 inline void setPrintBindings (bool en)
192 LuaBindingDoc::setPrintBindings (en);