Ardour  8.7-14-g57a6773833
Userdata.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 /*
3  https://github.com/vinniefalco/LuaBridge
4 
5  Copyright 2016, Robin Gareus <robin@gareus.org>
6  Copyright 2012, Vinnie Falco <vinnie.falco@gmail.com>
7 
8  License: The MIT License (http://www.opensource.org/licenses/mit-license.php)
9 
10  Permission is hereby granted, free of charge, to any person obtaining a copy
11  of this software and associated documentation files (the "Software"), to deal
12  in the Software without restriction, including without limitation the rights
13  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14  copies of the Software, and to permit persons to whom the Software is
15  furnished to do so, subject to the following conditions:
16 
17  The above copyright notice and this permission notice shall be included in all
18  copies or substantial portions of the Software.
19 
20  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26  SOFTWARE.
27 */
28 //==============================================================================
29 
30 //==============================================================================
55 #ifdef PLATFORM_WINDOWS
56 # ifdef COMPILER_MSVC
57 #include "LuaBridge/LuaBridge.h" /* Needed for LuaBridge_API */
59 # else
60 extern void* getIdentityKey ();
61 # endif
62 #else
63 inline void* getIdentityKey ()
64 {
65  static char value;
66  return &value;
67 }
68 #endif
69 
73 class Userdata
74 {
75 protected:
76  void* m_p; // subclasses must set this
77 
78  //--------------------------------------------------------------------------
82  inline void* getPointer () const
83  {
84  return m_p;
85  }
86 
87 private:
88  //--------------------------------------------------------------------------
97  int narg,
98  void const* classKey)
99  {
100  Userdata* ud = 0;
101  int const index = lua_absindex (L, narg);
102 
103  bool mismatch = false;
104  char const* got = 0;
105 
106  lua_rawgetp (L, LUA_REGISTRYINDEX, classKey);
107  assert (lua_istable (L, -1));
108 
109  // Make sure we have a userdata.
110  if (!lua_isuserdata (L, index))
111  mismatch = true;
112 
113  // Make sure it's metatable is ours.
114  if (!mismatch)
115  {
116  lua_getmetatable (L, index);
117  lua_rawgetp (L, -1, getIdentityKey ());
118  if (lua_isboolean (L, -1))
119  {
120  lua_pop (L, 1);
121  }
122  else
123  {
124  lua_pop (L, 2);
125  mismatch = true;
126  }
127  }
128 
129  if (!mismatch)
130  {
131  if (lua_rawequal (L, -1, -2))
132  {
133  // Matches class table.
134  lua_pop (L, 2);
135  ud = static_cast <Userdata*> (lua_touserdata (L, index));
136  }
137  else
138  {
139  rawgetfield (L, -2, "__const");
140  if (lua_rawequal (L, -1, -2))
141  {
142  // Matches const table
143  lua_pop (L, 3);
144  ud = static_cast <Userdata*> (lua_touserdata (L, index));
145  }
146  else
147  {
148  // Mismatch, but its one of ours so get a type name.
149  rawgetfield (L, -2, "__type");
150  lua_insert (L, -4);
151  lua_pop (L, 2);
152  got = lua_tostring (L, -2);
153  mismatch = true;
154  }
155  }
156  }
157 
158  if (mismatch)
159  {
160  rawgetfield (L, -1, "__type");
161  assert (lua_type (L, -1) == LUA_TSTRING);
162  char const* const expected = lua_tostring (L, -1);
163 
164  if (got == 0)
165  got = lua_typename (L, lua_type (L, index));
166 
167  char const* const msg = lua_pushfstring (
168  L, "%s expected, got %s", expected, got);
169 
170  if (narg > 0)
171  luaL_argerror (L, narg, msg);
172  else
173  lua_error (L);
174  }
175 
176  return ud;
177  }
178 
179  //--------------------------------------------------------------------------
189  int index,
190  void const* baseClassKey,
191  bool canBeConst,
192  bool errorOnMismatch = true)
193  {
194  assert (index > 0);
195  Userdata* ud = 0;
196 
197  bool mismatch = false;
198  char const* got = 0;
199 
200  lua_rawgetp (L, LUA_REGISTRYINDEX, baseClassKey);
201  assert (lua_istable (L, -1));
202 
203  // Make sure we have a userdata.
204  if (lua_isuserdata (L, index))
205  {
206  // Make sure it's metatable is ours.
207  lua_getmetatable (L, index);
208  lua_rawgetp (L, -1, getIdentityKey ());
209  if (lua_isboolean (L, -1))
210  {
211  lua_pop (L, 1);
212 
213  // If __const is present, object is NOT const.
214  rawgetfield (L, -1, "__const");
215  assert (lua_istable (L, -1) || lua_isnil (L, -1));
216  bool const isConst = lua_isnil (L, -1);
217  lua_pop (L, 1);
218 
219  // Replace the class table with the const table if needed.
220  if (isConst)
221  {
222  rawgetfield (L, -2, "__const");
223  assert (lua_istable (L, -1));
224  lua_replace (L, -3);
225  }
226 
227  for (;;)
228  {
229  if (lua_rawequal (L, -1, -2))
230  {
231  lua_pop (L, 2);
232 
233  // Match, now check const-ness.
234  if (isConst && !canBeConst)
235  {
236  luaL_argerror (L, index, "cannot be const");
237  }
238  else
239  {
240  ud = static_cast <Userdata*> (lua_touserdata (L, index));
241  break;
242  }
243  }
244  else
245  {
246  // Replace current metatable with it's base class.
247  rawgetfield (L, -1, "__parent");
248 /*
249 ud
250 class metatable
251 ud metatable
252 ud __parent (nil)
253 */
254 
255  if (lua_isnil (L, -1))
256  {
257  lua_remove (L, -1);
258  // Mismatch, but its one of ours so get a type name.
259  rawgetfield (L, -1, "__type");
260  lua_insert (L, -3);
261  lua_pop (L, 1);
262  got = lua_tostring (L, -2);
263  mismatch = true;
264  break;
265  }
266  else
267  {
268  lua_remove (L, -2);
269  }
270  }
271  }
272  }
273  else
274  {
275  lua_pop (L, 2);
276  mismatch = true;
277  }
278  }
279  else
280  {
281  mismatch = true;
282  }
283 
284  if (mismatch && errorOnMismatch)
285  {
286  assert (lua_type (L, -1) == LUA_TTABLE);
287  rawgetfield (L, -1, "__type");
288  assert (lua_type (L, -1) == LUA_TSTRING);
289  char const* const expected = lua_tostring (L, -1);
290 
291  if (got == 0)
292  got = lua_typename (L, lua_type (L, index));
293 
294  char const* const msg = lua_pushfstring (
295  L, "%s expected, got %s", expected, got);
296 
297  luaL_argerror (L, index, msg);
298  }
299 
300  return ud;
301  }
302 
303 public:
304  virtual ~Userdata () { }
305 
306  static void* get_ptr (lua_State* L, int index) {
307  Userdata* ud = static_cast <Userdata*> (lua_touserdata (L, index));
308  return ud->m_p;
309  }
310 
311  //--------------------------------------------------------------------------
317  template <class T>
318  static inline Userdata* getExact (lua_State* L, int index)
319  {
320  return getExactClass (L, index, ClassInfo <T>::getClassKey ());
321  }
322 
323  //--------------------------------------------------------------------------
330  template <class T>
331  static inline T* get (lua_State* L, int index, bool canBeConst)
332  {
333  if (lua_isnil (L, index))
334  return 0;
335  else
336  return static_cast <T*> (getClass (L, index,
337  ClassInfo <T>::getClassKey (), canBeConst)->getPointer ());
338  }
339 
340  template <class T>
341  static inline T* try_get (lua_State* L, int index, bool canBeConst)
342  {
343  if (!lua_isnil (L, index)) {
344  Userdata* ud = getClass (L, index, ClassInfo <T>::getClassKey (), canBeConst, false);
345  if (ud) {
346  return static_cast <T*> (ud->getPointer ());
347  }
348  }
349  return 0;
350  }
351 };
352 
353 //----------------------------------------------------------------------------
360 template <class T>
361 class UserdataValue : public Userdata
362 {
363 private:
366 
367  char m_storage [sizeof (T)];
368 
369  inline T* getObject ()
370  {
371  // If this fails to compile it means you forgot to provide
372  // a Container specialization for your container!
373  //
374  return reinterpret_cast <T*> (&m_storage [0]);
375  }
376 
377 private:
382  {
383  m_p = getObject ();
384  }
385 
387  {
388  getObject ()->~T ();
389  }
390 
391 public:
398  static void* place (lua_State* const L)
399  {
400  UserdataValue <T>* const ud = new (
403  // If this goes off it means you forgot to register the class!
404  assert (lua_istable (L, -1));
405  lua_setmetatable (L, -2);
406  return ud->getPointer ();
407  }
408 
412  template <class U>
413  static inline void push (lua_State* const L, U const& u)
414  {
415  new (place (L)) U (u);
416  }
417 };
418 
419 //----------------------------------------------------------------------------
425 class UserdataPtr : public Userdata
426 {
427 private:
430 
431 private:
434  static void push (lua_State* L, void* const p, void const* const key)
435  {
436  if (p)
437  {
438  new (lua_newuserdata (L, sizeof (UserdataPtr))) UserdataPtr (p);
439  lua_rawgetp (L, LUA_REGISTRYINDEX, key);
440  // If this goes off it means you forgot to register the class!
441  assert (lua_istable (L, -1));
442  lua_setmetatable (L, -2);
443  }
444  else
445  {
446  lua_pushnil (L);
447  }
448  }
449 
452  static void push (lua_State* L, void const* const p, void const* const key)
453  {
454  if (p)
455  {
456  new (lua_newuserdata (L, sizeof (UserdataPtr)))
457  UserdataPtr (const_cast <void*> (p));
458  lua_rawgetp (L, LUA_REGISTRYINDEX, key);
459  // If this goes off it means you forgot to register the class!
460  assert (lua_istable (L, -1));
461  lua_setmetatable (L, -2);
462  }
463  else
464  {
465  lua_pushnil (L);
466  }
467  }
468 
469  explicit UserdataPtr (void* const p)
470  {
471  m_p = p;
472 
473  // Can't construct with a null pointer!
474  //
475  assert (m_p != 0);
476  }
477 
478  friend class LuaRef;
479  static inline void push_raw (lua_State* const L, void* p, const void* classkey)
480  {
481  new (lua_newuserdata (L, sizeof (UserdataPtr))) UserdataPtr (p);
482  lua_rawgetp (L, LUA_REGISTRYINDEX, classkey);
483  assert (lua_istable (L, -1));
484  lua_setmetatable (L, -2);
485  }
486 
487 public:
490  template <class T>
491  static inline void push (lua_State* const L, T* const p)
492  {
493  if (p)
494  push (L, p, ClassInfo <T>::getClassKey ());
495  else
496  lua_pushnil (L);
497  }
498 
501  template <class T>
502  static inline void push (lua_State* const L, T const* const p)
503  {
504  if (p)
505  push (L, p, ClassInfo <T>::getConstKey ());
506  else
507  lua_pushnil (L);
508  }
509 };
510 
511 //============================================================================
518 template <class C>
519 class UserdataShared : public Userdata
520 {
521 private:
524 
525  typedef typename TypeTraits::removeConst <
526  typename ContainerTraits <C>::Type>::Type T;
527 
528  C m_c;
529 
530 private:
532  {
533  }
534 
535 public:
539  template <class U>
540  explicit UserdataShared (U const& u) : m_c (u)
541  {
542  m_p = const_cast <void*> (reinterpret_cast <void const*> (
544  }
545 
549  template <class U>
550  explicit UserdataShared (U* u) : m_c (u)
551  {
552  m_p = const_cast <void*> (reinterpret_cast <void const*> (
554  }
555 };
556 
557 //----------------------------------------------------------------------------
558 //
559 // SFINAE helpers.
560 //
561 
562 // non-const objects
563 template <class C, bool makeObjectConst>
565 {
566  typedef typename TypeTraits::removeConst <
567  typename ContainerTraits <C>::Type>::Type T;
568 
569  static void push (lua_State* L, C const& c)
570  {
571  if (ContainerTraits <C>::get (c) != 0)
572  {
573  new (lua_newuserdata (L, sizeof (UserdataShared <C>))) UserdataShared <C> (c);
575  // If this goes off it means the class T is unregistered!
576  assert (lua_istable (L, -1));
577  lua_setmetatable (L, -2);
578  }
579  else
580  {
581  lua_pushnil (L);
582  }
583  }
584 
585  static void push (lua_State* L, T* const t)
586  {
587  if (t)
588  {
589  new (lua_newuserdata (L, sizeof (UserdataShared <C>))) UserdataShared <C> (t);
591  // If this goes off it means the class T is unregistered!
592  assert (lua_istable (L, -1));
593  lua_setmetatable (L, -2);
594  }
595  else
596  {
597  lua_pushnil (L);
598  }
599  }
600 };
601 
602 // const objects
603 template <class C>
604 struct UserdataSharedHelper <C, true>
605 {
606  typedef typename TypeTraits::removeConst <
607  typename ContainerTraits <C>::Type>::Type T;
608 
609  static void push (lua_State* L, C const& c)
610  {
611  if (ContainerTraits <C>::get (c) != 0)
612  {
613  new (lua_newuserdata (L, sizeof (UserdataShared <C>))) UserdataShared <C> (c);
615  // If this goes off it means the class T is unregistered!
616  assert (lua_istable (L, -1));
617  lua_setmetatable (L, -2);
618  }
619  else
620  {
621  lua_pushnil (L);
622  }
623  }
624 
625  static void push (lua_State* L, T* const t)
626  {
627  if (t)
628  {
629  new (lua_newuserdata (L, sizeof (UserdataShared <C>))) UserdataShared <C> (t);
631  // If this goes off it means the class T is unregistered!
632  assert (lua_istable (L, -1));
633  lua_setmetatable (L, -2);
634  }
635  else
636  {
637  lua_pushnil (L);
638  }
639  }
640 };
641 
651 template <class C, bool byContainer, bool isEnum>
653 {
654  static inline void push (lua_State* L, C const& c)
655  {
658  }
659 
660  typedef typename TypeTraits::removeConst <
661  typename ContainerTraits <C>::Type>::Type T;
662 
663  static inline C get (lua_State* L, int index)
664  {
665  return Userdata::get <T> (L, index, true);
666  }
667 };
668 
676 template <class T>
677 struct StackHelper <T, false, false>
678 {
679  static inline void push (lua_State* L, T const& t)
680  {
682  }
683 
684  static inline T const& get (lua_State* L, int index)
685  {
686  return *Userdata::get <T> (L, index, true);
687  }
688 };
689 
690 template <class T>
691 struct StackHelper <T, false, true>
692 {
693  static inline void push (lua_State* L, T const& t)
694  {
695  int v = static_cast <int> (t);
696  lua_pushinteger (L, static_cast <lua_Integer> (v));
697  }
698 
699  static inline T get (lua_State* L, int index)
700  {
701  int v = static_cast <int> (luaL_checkinteger (L, index));
702  return T (v);
703  }
704 };
705 
706 //==============================================================================
707 
711 template <class T>
712 struct Stack
713 {
714 public:
715  static inline void push (lua_State* L, T const& t)
716  {
717  StackHelper <T,
720  }
721 
722  static inline T get (lua_State* L, int index)
723  {
724  return StackHelper <T,
727  }
728 };
729 
730 //------------------------------------------------------------------------------
739 // pointer
740 template <class T>
741 struct Stack <T*>
742 {
743  static inline void push (lua_State* L, T* const p)
744  {
745  UserdataPtr::push (L, p);
746  }
747 
748  static inline T* get (lua_State* L, int index)
749  {
750  return Userdata::get <T> (L, index, false);
751  }
752 };
753 
754 // Strips the const off the right side of *
755 template <class T>
756 struct Stack <T* const>
757 {
758  static inline void push (lua_State* L, T* const p)
759  {
760  UserdataPtr::push (L, p);
761  }
762 
763  static inline T* get (lua_State* L, int index)
764  {
765  return Userdata::get <T> (L, index, false);
766  }
767 };
768 
769 // pointer to const
770 template <class T>
771 struct Stack <T const*>
772 {
773  static inline void push (lua_State* L, T const* const p)
774  {
775  UserdataPtr::push (L, p);
776  }
777 
778  static inline T const* get (lua_State* L, int index)
779  {
780  return Userdata::get <T> (L, index, true);
781  }
782 };
783 
784 // Strips the const off the right side of *
785 template <class T>
786 struct Stack <T const* const>
787 {
788  static inline void push (lua_State* L, T const* const p)
789  {
790  UserdataPtr::push (L, p);
791  }
792 
793  static inline T const* get (lua_State* L, int index)
794  {
795  return Userdata::get <T> (L, index, true);
796  }
797 };
798 
799 // const references to class-instance pointers
800 // e.g. std::list<T*>::push_back ( const T* & )
801 template <class T>
802 struct Stack <T* const&>
803 {
804  static inline void push (lua_State* L, T* const& p)
805  {
806  UserdataPtr::push (L, p);
807  }
808 
809  static inline T* get (lua_State* L, int index)
810  {
811  return Userdata::get <T> (L, index, true);
812  }
813 };
814 
815 // reference
816 template <class T>
817 struct Stack <T&>
818 {
819  static inline void push (lua_State* L, T& t)
820  {
821  UserdataPtr::push (L, &t);
822  }
823 
824  static T& get (lua_State* L, int index)
825  {
826  T* const t = Userdata::get <T> (L, index, false);
827  if (!t)
828  luaL_error (L, "nil passed to reference");
829  return *t;
830  }
831 };
832 
833 template <class C, bool byContainer>
835 {
836  typedef C return_type;
837 
838  static inline void push (lua_State* L, C const& t)
839  {
842  }
843 
844  typedef typename TypeTraits::removeConst <
845  typename ContainerTraits <C>::Type>::Type T;
846 
847  static return_type get (lua_State* L, int index)
848  {
849  return Userdata::get <T> (L, index, true);
850  }
851 };
852 
853 template <class T>
854 struct RefStackHelper <T, false>
855 {
856  typedef T const& return_type;
857 
858  static inline void push (lua_State* L, T const& t)
859  {
860  UserdataPtr::push (L, &t);
861  }
862 
863  static return_type get (lua_State* L, int index)
864  {
865  T const* const t = Userdata::get <T> (L, index, true);
866 
867  if (!t)
868  luaL_error (L, "nil passed to reference");
869  return *t;
870  }
871 
872 };
873 
874 // reference to const
875 template <class T>
876 struct Stack <T const&>
877 {
879 
880  static inline void push (lua_State* L, T const& t)
881  {
882  helper_t::push (L, t);
883  }
884 
885  static typename helper_t::return_type get (lua_State* L, int index)
886  {
887  return helper_t::get (L, index);
888  }
889 };
#define LuaBridge_API
Definition: ClassInfo.h:36
void rawgetfield(lua_State *L, int index, char const *key)
Definition: LuaHelpers.h:106
void * getIdentityKey()
Definition: Userdata.h:63
Definition: LuaRef.h:52
static void push(lua_State *const L, T *const p)
Definition: Userdata.h:491
static void push_raw(lua_State *const L, void *p, const void *classkey)
Definition: Userdata.h:479
static void push(lua_State *const L, T const *const p)
Definition: Userdata.h:502
static void push(lua_State *L, void const *const p, void const *const key)
Definition: Userdata.h:452
static void push(lua_State *L, void *const p, void const *const key)
Definition: Userdata.h:434
UserdataPtr(void *const p)
Definition: Userdata.h:469
UserdataPtr operator=(UserdataPtr const &)
UserdataPtr(UserdataPtr const &)
UserdataShared(U const &u)
Definition: Userdata.h:540
UserdataShared(U *u)
Definition: Userdata.h:550
UserdataShared(UserdataShared< C > const &)
TypeTraits::removeConst< typename ContainerTraits< C >::Type >::Type T
Definition: Userdata.h:526
UserdataShared< C > & operator=(UserdataShared< C > const &)
UserdataValue(UserdataValue< T > const &)
char m_storage[sizeof(T)]
Definition: Userdata.h:367
static void * place(lua_State *const L)
Definition: Userdata.h:398
static void push(lua_State *const L, U const &u)
Definition: Userdata.h:413
T * getObject()
Definition: Userdata.h:369
UserdataValue< T > operator=(UserdataValue< T > const &)
static Userdata * getExactClass(lua_State *L, int narg, void const *classKey)
Definition: Userdata.h:96
static T * get(lua_State *L, int index, bool canBeConst)
Definition: Userdata.h:331
static Userdata * getClass(lua_State *L, int index, void const *baseClassKey, bool canBeConst, bool errorOnMismatch=true)
Definition: Userdata.h:188
static T * try_get(lua_State *L, int index, bool canBeConst)
Definition: Userdata.h:341
static Userdata * getExact(lua_State *L, int index)
Definition: Userdata.h:318
void * getPointer() const
Definition: Userdata.h:82
void * m_p
Definition: Userdata.h:76
static void * get_ptr(lua_State *L, int index)
Definition: Userdata.h:306
virtual ~Userdata()
Definition: Userdata.h:304
int() luaL_error(lua_State *L, const char *fmt,...)
lua_Integer() luaL_checkinteger(lua_State *L, int arg)
int() luaL_argerror(lua_State *L, int arg, const char *extramsg)
int() lua_absindex(lua_State *L, int idx)
Definition: LuaHelpers.h:33
#define lua_replace(L, idx)
#define lua_istable(L, n)
#define lua_insert(L, idx)
int() lua_rawgetp(lua_State *L, int idx, const void *p)
Definition: LuaHelpers.h:41
#define LUA_TTABLE
Definition: lua-5.3.5/lua.h:69
int() lua_error(lua_State *L)
#define LUA_REGISTRYINDEX
Definition: lua-5.3.5/lua.h:42
LUA_INTEGER lua_Integer
Definition: lua-5.3.5/lua.h:93
int() lua_rawequal(lua_State *L, int idx1, int idx2)
int() lua_setmetatable(lua_State *L, int objindex)
#define LUA_TSTRING
Definition: lua-5.3.5/lua.h:68
void *() lua_newuserdata(lua_State *L, size_t sz)
const char *() lua_pushfstring(lua_State *L, const char *fmt,...)
void() lua_pushinteger(lua_State *L, lua_Integer n)
int() lua_type(lua_State *L, int idx)
#define lua_remove(L, idx)
void *() lua_touserdata(lua_State *L, int idx)
#define lua_isnil(L, n)
void() lua_pushnil(lua_State *L)
#define lua_pop(L, n)
int() lua_getmetatable(lua_State *L, int objindex)
int() lua_isuserdata(lua_State *L, int idx)
#define lua_tostring(L, i)
const char *() lua_typename(lua_State *L, int tp)
#define lua_isboolean(L, n)
void push(lua_State *L, T t)
Definition: LuaBridge.h:160
static return_type get(lua_State *L, int index)
Definition: Userdata.h:863
static void push(lua_State *L, T const &t)
Definition: Userdata.h:858
static return_type get(lua_State *L, int index)
Definition: Userdata.h:847
TypeTraits::removeConst< typename ContainerTraits< C >::Type >::Type T
Definition: Userdata.h:845
static void push(lua_State *L, C const &t)
Definition: Userdata.h:838
static T const & get(lua_State *L, int index)
Definition: Userdata.h:684
static void push(lua_State *L, T const &t)
Definition: Userdata.h:679
static void push(lua_State *L, T const &t)
Definition: Userdata.h:693
static T get(lua_State *L, int index)
Definition: Userdata.h:699
static C get(lua_State *L, int index)
Definition: Userdata.h:663
TypeTraits::removeConst< typename ContainerTraits< C >::Type >::Type T
Definition: Userdata.h:661
static void push(lua_State *L, C const &c)
Definition: Userdata.h:654
static T * get(lua_State *L, int index)
Definition: Userdata.h:748
static void push(lua_State *L, T *const p)
Definition: Userdata.h:743
static T * get(lua_State *L, int index)
Definition: Userdata.h:763
static void push(lua_State *L, T *const p)
Definition: Userdata.h:758
static T * get(lua_State *L, int index)
Definition: Userdata.h:809
static void push(lua_State *L, T *const &p)
Definition: Userdata.h:804
static T & get(lua_State *L, int index)
Definition: Userdata.h:824
static void push(lua_State *L, T &t)
Definition: Userdata.h:819
static void push(lua_State *L, T const *const p)
Definition: Userdata.h:773
static T const * get(lua_State *L, int index)
Definition: Userdata.h:778
static T const * get(lua_State *L, int index)
Definition: Userdata.h:793
static void push(lua_State *L, T const *const p)
Definition: Userdata.h:788
static helper_t::return_type get(lua_State *L, int index)
Definition: Userdata.h:885
RefStackHelper< T, TypeTraits::isContainer< T >::value > helper_t
Definition: Userdata.h:878
static void push(lua_State *L, T const &t)
Definition: Userdata.h:880
static T get(lua_State *L, int index)
Definition: Userdata.h:722
static void push(lua_State *L, T const &t)
Definition: Userdata.h:715
TypeTraits::removeConst< typename ContainerTraits< C >::Type >::Type T
Definition: Userdata.h:607
static void push(lua_State *L, T *const t)
Definition: Userdata.h:625
static void push(lua_State *L, C const &c)
Definition: Userdata.h:609
static void push(lua_State *L, C const &c)
Definition: Userdata.h:569
TypeTraits::removeConst< typename ContainerTraits< C >::Type >::Type T
Definition: Userdata.h:567
static void push(lua_State *L, T *const t)
Definition: Userdata.h:585