EasyLua  1.0
Lua API meta compiler for C++.
easylua.hpp
Go to the documentation of this file.
1 
10 #include <stdexcept>
11 #include <tuple>
12 #include <cstdlib>
13 #include <cstring>
14 #include <unordered_map>
15 
16 #include <lua.hpp>
17 
18 // Define __forceinline if we're on GCC
19 #if defined(__GNUC__) || defined(__GNUG__)
20  #define __forceinline __attribute__((always_inline))
21 #endif
22 
23 #define INLINE __forceinline
24 
29 namespace EasyLua
30 {
31  typedef size_t StringLength;
32  typedef size_t ParameterCount;
33  typedef size_t ReturnCount;
34 
37  {
46  };
47 
48  class Table;
49 
54  namespace Resolvers
55  {
61  template <typename type>
62  struct TypeIDResolver { };
63 
70  template <>
71  struct TypeIDResolver<int>
72  {
73  static const unsigned char value = EasyLua::EASYLUA_INTEGER;
74  };
75 
82  template <>
83  struct TypeIDResolver<float>
84  {
85  static const unsigned char value = EasyLua::EASYLUA_FLOAT;
86  };
87 
94  template <>
95  struct TypeIDResolver<char>
96  {
97  static const unsigned char value = EasyLua::EASYLUA_STRING;
98  };
99 
106  template <>
108  {
109  static const unsigned char value = EasyLua::EASYLUA_TABLE;
110  };
111 
118  template <>
119  struct TypeIDResolver<size_t>
120  {
121  static const unsigned char value = EasyLua::EASYLUA_INTEGER;
122  };
123 
124  // Table builder
125  template <bool createTable>
127 
128  template <>
129  struct TableCreationResolver<true> { static INLINE void resolve(lua_State *lua) { lua_createtable(lua, 0, 0); } };
130 
131  template <>
132  struct TableCreationResolver<false> { static INLINE void resolve(lua_State *lua) { } };
133 
134  // Type Checker
135  template <bool typeCheck, typename inputType>
136  struct StackReadResolver { };
137 
138  static const char *EXCEPTION_FORMAT = "Expected %s (type ID %u) at stack index %u! Got type ID %u instead.";
139 
140  template <>
141  struct StackReadResolver<true, int>
142  {
143  static INLINE bool resolve(lua_State *lua, const int &index, int *out)
144  {
145  const int type = lua_type(lua, index);
146 
147  if (type != LUA_TNUMBER)
148  {
149  char error[256];
150  sprintf(error, EXCEPTION_FORMAT, "integer (number) ", LUA_TNUMBER, index, type);
151 
152  throw std::runtime_error(error);
153  }
154 
155  *out = lua_tointeger(lua, index);
156  return true;
157  }
158  };
159 
160  template <>
161  struct StackReadResolver<true, float>
162  {
163  static INLINE bool resolve(lua_State *lua, const int &index, float *out)
164  {
165  const int type = lua_type(lua, index);
166 
167  if (type != LUA_TNUMBER)
168  {
169  char error[256];
170  sprintf(error, EXCEPTION_FORMAT, "float (number)", LUA_TNUMBER, index, type);
171 
172  throw std::runtime_error(error);
173  }
174 
175  *out = lua_tonumber(lua, index);
176  return true;
177  }
178  };
179 
180  template <>
181  struct StackReadResolver<true, char *>
182  {
183  static INLINE bool resolve(lua_State *lua, const int &index, char *out)
184  {
185  const int type = lua_type(lua, index);
186 
187  if (type != LUA_TSTRING)
188  {
189  char error[256];
190  sprintf(error, EXCEPTION_FORMAT, "string", LUA_TSTRING, index, type);
191 
192  throw std::runtime_error(error);
193  }
194 
195  out = const_cast<char *>(lua_tostring(lua, index));
196  return true;
197  }
198  };
199 
200  template <>
201  struct StackReadResolver<true, int *>
202  {
203  static INLINE bool resolve(lua_State *lua, const int &index, void *out)
204  {
205  const int type = lua_type(lua, index);
206 
207  if (type != LUA_TUSERDATA)
208  {
209  char error[256];
210  sprintf(error, EXCEPTION_FORMAT, "user data", LUA_TUSERDATA, index, type);
211 
212  throw std::runtime_error(error);
213  }
214 
215  out = const_cast<void *>(lua_touserdata(lua, index));
216  return true;
217  }
218  };
219 
220  // No exception
221  template <>
222  struct StackReadResolver<false, char *>
223  {
224  static INLINE bool resolve(lua_State *lua, const int &index, char *out)
225  {
226  const int type = lua_type(lua, index);
227 
228  if (type != LUA_TSTRING)
229  return false;
230 
231  out = const_cast<char *>(lua_tostring(lua, index));
232  return true;
233  }
234  };
235 
236  template <>
237  struct StackReadResolver<false, float>
238  {
239  static INLINE bool resolve(lua_State *lua, const int &index, float *out)
240  {
241  const int type = lua_type(lua, index);
242 
243  if (type != LUA_TNUMBER)
244  return false;
245 
246  *out = lua_tonumber(lua, index);
247  return true;
248  }
249  };
250 
251  template <>
252  struct StackReadResolver<false, int *>
253  {
254  static INLINE bool resolve(lua_State *lua, const int &index, void *out)
255  {
256  const int type = lua_type(lua, index);
257 
258  if (type != LUA_TUSERDATA)
259  return false;
260 
261  out = lua_touserdata(lua, index);
262  return true;
263  }
264  };
265 
266  template <>
267  struct StackReadResolver<false, int>
268  {
269  static INLINE bool resolve(lua_State *lua, const int &index, int *out)
270  {
271  const int type = lua_type(lua, index);
272 
273  if (type != LUA_TNUMBER)
274  return false;
275 
276  *out = lua_tointeger(lua, index);
277  return true;
278  }
279  };
280  }
281 
291  {
292  public:
293  void set(const char *key, const int &value)
294  {
295  static std::hash<const char *> hasher;
296 
297  const size_t hash = hasher(key);
298 
299  mIntegers[hash] = value;
300  mContents[hash] = &(mIntegers[hash]);
301  mTypes[hash] = std::make_pair(key, EasyLua::EASYLUA_INTEGER);
302  }
303 
304  void set(const char *key, const float &value)
305  {
306  static std::hash<const char *> hasher;
307 
308  const size_t hash = hasher(key);
309 
310  mFloats[hash] = value;
311  mContents[hash] = &(mFloats[hash]);
312  mTypes[hash] = std::make_pair(key, EasyLua::EASYLUA_FLOAT);
313  }
314 
315  void set(const char *key, const char *value)
316  {
317  static std::hash<const char *> hasher;
318 
319  const size_t hash = hasher(key);
320 
321  mStrings[hash] = value;
322  mContents[hash] = &(mStrings[hash]);
323  mTypes[hash] = std::make_pair(key, EasyLua::EASYLUA_STRING);
324  }
325 
326  // void get(const char *key, Table *out)
327  // {
328 
329  // }
330 
331  //virtual void push(lua_State *lua) = 0;
332 
333  //void remove(const char *key)
334  // {
335 
336  // }
337 
338  public:
339  std::unordered_map<size_t, float> mFloats;
340  std::unordered_map<size_t, int> mIntegers;
341  std::unordered_map<size_t, std::string> mStrings;
342 
343  std::unordered_map<size_t, void *> mContents;
344 
345  // std::unordered_map<size_t, std::pair<const char *, const void *>> mContents;
346  std::unordered_map<size_t, std::pair<const char *, unsigned char>> mTypes;
347  };
348 
349  class Table : public ParentTable
350  {
351  public:
352  void copy(const ParentTable &other)
353  {
354  mFloats = other.mFloats;
355  mStrings = other.mStrings;
356  mIntegers = other.mIntegers;
357  mContents = other.mContents;
358  mTypes = other.mTypes;
359  // mTables = other.mTables;
360  }
361 
362  template <typename outType>
363  void get(const char *key, outType &out)
364  {
365  static std::hash<const char *> hasher;
366 
367  const size_t hash = hasher(key);
368 
369  if (mTypes.count(hash) == 0)
370  throw std::runtime_error("No such key!");
371  else if (mTypes[hash].second != EasyLua::Resolvers::TypeIDResolver<outType>::value)
372  throw std::runtime_error("Mismatched types!");
373 
374  out = *((outType*)(mContents[hash]));
375  }
376 
377  void push(lua_State *lua)
378  {
379  lua_createtable(lua, 0, 0);
380 
381  for (std::unordered_map<size_t, std::pair<const char *, unsigned char>>::iterator it = mTypes.begin(); it != mTypes.end(); it++)
382  {
383  const size_t hash = (*it).first;
384  std::pair<const char *, unsigned char> current = (*it).second;
385 
386  lua_pushstring(lua, current.first);
387 
388  switch (current.second)
389  {
391  {
392  lua_pushnumber(lua, mFloats[hash]);
393  break;
394  }
395 
397  {
398  lua_pushstring(lua, mStrings[hash].c_str());
399  break;
400  }
401 
403  {
404  lua_pushinteger(lua, mIntegers[hash]);
405  break;
406  }
407 
409  {
410  reinterpret_cast<Table *>(&mTables[hash])->push(lua);
411  break;
412  }
413  }
414 
415  lua_settable(lua, -3);
416  }
417  }
418 
419  void setTable(const char *key, const ParentTable &value)
420  {
421  static std::hash<const char *> hasher;
422 
423  const size_t hash = hasher(key);
424 
425  mTables[hash] = value;
426  mTypes[hash] = std::make_pair(key, EasyLua::EASYLUA_TABLE);
427  }
428 
429  private:
430  std::unordered_map<size_t, ParentTable> mTables;
431  };
432 
433 
434  template <>
435  void Table::get(const char *key, Table &out)
436  {
437  static std::hash<const char *> hasher;
438 
439  const size_t hash = hasher(key);
440 
441  if (mTypes.count(hash) == 0)
442  throw std::runtime_error("No such key!");
443 
444  out.copy(mTables[hash]);
445  }
446 
447 
449  {
450 
451  };
452 
459  class Utilities
460  {
461  // Public Methods
462  public:
463 
471  template <typename... parameters>
472  static INLINE void pushParameters(lua_State *lua, const int &in, parameters... params)
473  {
474  lua_pushinteger(lua, in);
475  EasyLua::Utilities::pushParameters(lua, params...);
476  }
477 
485  template <typename... parameters>
486  static INLINE void pushParameters(lua_State *lua, const float &in, parameters... params)
487  {
488  lua_pushnumber(lua, in);
489  EasyLua::Utilities::pushParameters(lua, params...);
490  }
491 
499  template <typename... parameters>
500  static INLINE void pushParameters(lua_State *lua, const char *in, parameters... params)
501  {
502  lua_pushstring(lua, in);
503  EasyLua::Utilities::pushParameters(lua, params...);
504  }
505 
513  template <typename... parameters>
514  static INLINE void pushParameters(lua_State *lua, const bool &in, parameters... params)
515  {
516  lua_pushboolean(lua, in);
517  EasyLua::Utilities::pushParameters(lua, params...);
518  }
519 
527  template <bool createTable = true, typename... parameters>
528  static INLINE void pushTable(lua_State *lua, const char *key, const int &value, parameters... params)
529  {
531 
532  lua_pushstring(lua, key);
533  lua_pushinteger(lua, value);
534  lua_settable(lua, -3);
535 
536  EasyLua::Utilities::pushTable<false>(lua, params...);
537  }
538 
546  template <bool createTable = true, typename... parameters>
547  static INLINE void pushTable(lua_State *lua, const char *key, const float &value, parameters... params)
548  {
550 
551  lua_pushstring(lua, key);
552  lua_pushnumber(lua, value);
553  lua_settable(lua, -3);
554 
555  EasyLua::Utilities::pushTable<false>(lua, params...);
556  }
557 
566  template <bool createTable = true, typename... parameters>
567  static INLINE void pushTable(lua_State *lua, const char *key, const double &value, parameters... params)
568  {
570 
571  lua_pushstring(lua, key);
572  lua_pushnumber(lua, value);
573  lua_settable(lua, -3);
574 
575  EasyLua::Utilities::pushTable<false>(lua, params...);
576  }
577 
585  template <bool createTable = true, typename... parameters>
586  static INLINE void *pushTable(lua_State *lua, const char *key, const bool &value, parameters... params)
587  {
589 
590  lua_pushstring(lua, key);
591  lua_pushboolean(lua, value);
592  lua_settable(lua, -3);
593 
594  EasyLua::Utilities::pushTable<false>(lua, params...);
595  }
596 
604  template <bool createTable = true, typename... parameters>
605  static INLINE void pushTable(lua_State *lua, const char *key, const char *value, parameters... params)
606  {
608 
609  lua_pushstring(lua, key);
610  lua_pushstring(lua, value);
611  lua_settable(lua, -3);
612 
613  EasyLua::Utilities::pushTable<false>(lua, params...);
614  }
615 
624  template <typename... parameters>
625  static INLINE void pushTableComponents(lua_State *lua, parameters... params)
626  {
627  EasyLua::Utilities::pushTable<false>(lua, params...);
628  }
629 
635  template <typename... parameters>
636  static INLINE void *Table(lua_State *lua, parameters... params)
637  {
638  const size_t currentTop = lua_gettop(lua);
639 
640  EasyLua::Utilities::pushTable<true>(lua, params...);
641 
642  // TODO (Robert MacGregor#9): Statically resolve the necessity of this, it's only necessary for pushParameters
643  lua_insert(lua, 1); // Puts pushed tables in the right order for pushParameters
644 
645  return NULL;
646  }
647 
648  // Array Pusher
649  template <bool createTable = true, unsigned int index = 1, typename... parameters>
650  static INLINE void pushArray(lua_State *lua, const int &value, parameters... params)
651  {
653 
654  lua_pushinteger(lua, index);
655  lua_pushinteger(lua, value);
656  lua_settable(lua, -3);
657 
658  EasyLua::Utilities::pushArray<false, index + 1>(lua, params...);
659  }
660 
661  template <bool createTable = true, unsigned int index = 1, typename... parameters>
662  static INLINE void pushArray(lua_State *lua, const char *key, const float &value, parameters... params)
663  {
665 
666  lua_pushinteger(lua, index);
667  lua_pushnumber(lua, value);
668  lua_settable(lua, -3);
669 
670  EasyLua::Utilities::pushArray<false, index + 1>(lua, params...);
671  }
672 
673  template <bool createTable = true, unsigned int index = 1, typename... parameters>
674  static INLINE void pushArray(lua_State *lua, const char *key, const double &value, parameters... params)
675  {
677 
678  lua_pushinteger(lua, index);
679  lua_pushnumber(lua, value);
680  lua_settable(lua, -3);
681 
682  EasyLua::Utilities::pushArray<false, index + 1>(lua, params...);
683  }
684 
685  template <bool createTable = true, unsigned int index = 1, typename... parameters>
686  static INLINE void pushArray(lua_State *lua, const char *key, const bool &value, parameters... params)
687  {
689 
690  lua_pushinteger(lua, index);
691  lua_pushboolean(lua, value);
692  lua_settable(lua, -3);
693 
694  EasyLua::Utilities::pushArray<false, index + 1>(lua, params...);
695  }
696 
697  template <bool createTable = true, unsigned int index = 1, typename... parameters>
698  static INLINE void pushArray(lua_State *lua, const char *key, const char *value, parameters... params)
699  {
701 
702  lua_pushinteger(lua, index);
703  lua_pushstring(lua, value);
704  lua_settable(lua, -3);
705 
706  EasyLua::Utilities::pushArray<false, index + 1>(lua, params...);
707  }
708 
709  template <bool createTable = true, unsigned int index = 1>
710  static INLINE void pushArray(lua_State *lua) { }
711 
712  template <bool typeException, int index = 1, typename... parameters>
713  static INLINE int readStack(lua_State *lua, float *out, parameters... params)
714  {
716  return index;
717 
718  *out = luaL_checknumber(lua, index);
719  return EasyLua::Utilities::readStack<typeException, index + 1>(lua, params...);
720  }
721 
722  template <bool typeException, int index = 1, typename... parameters>
723  static INLINE int readStack(lua_State *lua, bool *out, parameters... params)
724  {
726 
727  *out = luaL_checkinteger(lua, index);
728  return EasyLua::Utilities::readStack<typeException, index + 1>(lua, params...);
729  }
730 
731  template <bool typeException, int index = 1, typename... parameters>
732  static INLINE int readStack(lua_State *lua, int *out, parameters... params)
733  {
735  return index;
736 
737  return EasyLua::Utilities::readStack<typeException, index + 1>(lua, params...);
738  }
739 
740  template <bool typeException, int index = 1, typename... parameters>
741  static INLINE int readStack(lua_State *lua, char *out, const int &outLength, parameters... params)
742  {
744  return index;
745 
746  // We want to read a string of max size outLength
747  const char *target = luaL_checkstring(lua, index);
748 
749  // Copy the target memory to our out pointer
750  unsigned int targetLength = strlen(target);
751  targetLength = outLength > targetLength ? targetLength : targetLength - outLength;
752  memcpy(out, target, targetLength);
753 
754  return EasyLua::Utilities::readStack<typeException, index + 1>(lua, params...);
755  }
756 
757  template <bool typeException, int index = 1, typename... parameters>
758  static INLINE int readStack(lua_State *lua, std::string *out, parameters... params)
759  {
760  char *outTest = 0x00;
761 
763  return index;
764 
765  out->assign(luaL_checkstring(lua, index));
766 
767  return EasyLua::Utilities::readStack<typeException, index + 1>(lua, params...);
768  }
769 
770  template <bool typeException, int index = 1, typename... parameters>
771  static INLINE int readStack(lua_State *lua, void *out, parameters... params)
772  {
774 
775  out = lua_touserdata(lua, index);
776  return EasyLua::Utilities::readStack<typeException, index + 1>(lua, params...);
777  }
778 
779  static void printStack(lua_State *lua)
780  {
781  std::cout << "Lua Stack Dump ------ " << std::endl;
782 
783  for (int iteration = 0; iteration < lua_gettop(lua) + 1; iteration++)
784  {
785  const int currentType = lua_type(lua, iteration);
786  std::cout << iteration << ": ";
787 
788  switch (currentType)
789  {
790  case LUA_TNUMBER:
791  {
792  std::cout << "NUMBER (" << LUA_TNUMBER << ") = " << luaL_checknumber(lua, iteration);
793  break;
794  }
795 
796  case LUA_TSTRING:
797  {
798  std::cout << "STRING (" << LUA_TSTRING << ") = '" << luaL_checkstring(lua, iteration) << "'";
799  break;
800  }
801 
802  case LUA_TFUNCTION:
803  {
804  std::cout << "FUNCTION (" << LUA_TFUNCTION << ") ";
805  break;
806  }
807 
808  case LUA_TTABLE:
809  {
810  std::cout << "TABLE (" << LUA_TTABLE << ") ";
811  break;
812  }
813 
814  default:
815  {
816  std::cout << "UNKNOWN TYPE (" << currentType << ") ";
817  }
818  }
819 
820  std::cout << std::endl;
821  }
822  }
823 
832  template <typename... parameters>
833  static INLINE void pushParameters(lua_State *lua, const void *value, parameters... params)
834  {
835  // Tables will stack at the bottom so we correct this as we run
836  lua_pushvalue(lua, 1);
837  lua_remove(lua, 1);
838 
839  EasyLua::Utilities::pushParameters(lua, params...);
840  }
841 
842 
843  // Private Methods
844  private:
846  Utilities(void) { }
848  ~Utilities(void) { }
849 
856  static INLINE void pushParameters(lua_State *lua) { }
857 
864  template <bool createTable = true>
865  static INLINE void pushTable(lua_State *lua) { }
866 
867  template <bool createTable = true, typename... parameters>
868  static INLINE void pushTable(lua_State *lua, const char *key, const void *value, parameters... params)
869  {
871  EasyLua::Utilities::pushTable<false>(lua, params...);
872 
873  // We'll have two tables at the top and we need to swap them for correct assignment as
874  // the ordering will be inner then outer
875  lua_insert(lua, -2);
876  lua_pushstring(lua, key);
877  lua_insert(lua, -2);
878  lua_settable(lua, -3);
879  }
880 
881  template <bool typeException, int index = -1>
882  static INLINE int readStack(lua_State *lua) { return -1; }
883  }; // End Class Utilities
884 
891  template <typename... parameters>
892  static INLINE unsigned int call(lua_State *lua, const char *methodName, parameters... params)
893  {
894  const int stackTop = lua_gettop(lua);
895  EasyLua::Utilities::pushParameters(lua, params...);
896 
897  // We get the method now so it is at a predictable position to move correctly
898  lua_getglobal(lua, methodName);
899  lua_insert(lua, 1);
900 
901  lua_call(lua, sizeof...(params), LUA_MULTRET);
902 
903  return lua_gettop(lua) - stackTop;
904  }
905 
906  static INLINE unsigned int call(lua_State *lua, const char *methodName, const EasyLua::ParameterCount &parameterCount)
907  {
908  const int stackTop = lua_gettop(lua);
909 
910  lua_getglobal(lua, methodName);
911  lua_insert(lua, 1);
912  lua_call(lua, parameterCount, LUA_MULTRET);
913 
914  return lua_gettop(lua) - stackTop;
915  }
916 
917  template <typename... parameters>
918  static INLINE std::pair<int, size_t> pcall(lua_State *lua, const char *methodName, parameters... params)
919  {
920  const int stackTop = lua_gettop(lua);
921 
922  lua_getglobal(lua, methodName);
923  EasyLua::Utilities::pushParameters(lua, params...);
924 
925  return std::make_pair(lua_pcall(lua, sizeof...(params), LUA_MULTRET, 0), lua_gettop(lua) - stackTop);
926  }
927 
928  static INLINE std::pair<int, size_t> pcall(lua_State *lua, const char *methodName, const EasyLua::ParameterCount &parameterCount)
929  {
930  const int stackTop = lua_gettop(lua);
931 
932  lua_getglobal(lua, methodName);
933  return std::make_pair(lua_pcall(lua, parameterCount, LUA_MULTRET, 0), lua_gettop(lua) - stackTop);
934  }
935 
936  static INLINE std::pair<int, size_t> pcall(lua_State *lua, const char *methodName, const char *errorHandler, const EasyLua::ParameterCount &parameterCount)
937  {
938  const int stackTop = lua_gettop(lua);
939 
940  lua_getglobal(lua, errorHandler);
941  lua_getglobal(lua, methodName);
942 
943  return std::make_pair(lua_pcall(lua, parameterCount, LUA_MULTRET, -2), lua_gettop(lua) - stackTop);
944  }
945 
946  template <typename... parameters>
947  static INLINE std::pair<int, size_t> pcall(lua_State *lua, const char *methodName, const char *errorHandler, parameters... params)
948  {
949  const int stackTop = lua_gettop(lua);
950 
951  lua_getglobal(lua, errorHandler);
952  lua_getglobal(lua, methodName);
953  EasyLua::Utilities::pushParameters(lua, params...);
954 
955  return std::make_pair(lua_pcall(lua, sizeof...(params), LUA_MULTRET, sizeof...(params) - 2), lua_gettop(lua) - stackTop);
956  } // End "NameSpace" Utilities
957 } // End NameSpace EasyLua
Definition: easylua.hpp:448
This "namespace" contains a bulk of the EasyLua API that the end programmer should be concerned with...
Definition: easylua.hpp:459
static INLINE void pushTableComponents(lua_State *lua, parameters...params)
A helper method that can be used to push more components to the current table.
Definition: easylua.hpp:625
static INLINE void pushTable(lua_State *lua, const char *key, const int &value, parameters...params)
This is one among a family of methods that push a table containing arbitrary values to the Lua stack...
Definition: easylua.hpp:528
Definition: easylua.hpp:136
Definition: easylua.hpp:349
static INLINE void pushParameters(lua_State *lua, const bool &in, parameters...params)
This is one among a family of methods that push arbitrary values to the Lua stack.
Definition: easylua.hpp:514
static INLINE void pushParameters(lua_State *lua, const float &in, parameters...params)
This is one among a family of methods that push arbitrary values to the Lua stack.
Definition: easylua.hpp:486
static INLINE void pushParameters(lua_State *lua, const void *value, parameters...params)
This is one among a family of methods that push arbitrary values to the Lua stack.
Definition: easylua.hpp:833
static INLINE void * pushTable(lua_State *lua, const char *key, const bool &value, parameters...params)
This is one among a family of methods that push a table containing arbitrary values to the Lua stack...
Definition: easylua.hpp:586
The TypeIDResolver template struct is used to resolve EasyLua types to their internal EasyLua type id...
Definition: easylua.hpp:62
A class that represents Lua table objects. This can be used to read table returns from the Lua runtim...
Definition: easylua.hpp:290
String types.
Definition: easylua.hpp:41
Anything that is an integer.
Definition: easylua.hpp:39
static INLINE void pushParameters(lua_State *lua, const int &in, parameters...params)
This is one among a family of methods that push arbitrary values to the Lua stack.
Definition: easylua.hpp:472
Table types.
Definition: easylua.hpp:43
EASYLUA_TYPE
Enumeration representing the supported types in the EasyLua library.
Definition: easylua.hpp:36
This namespace contains all of the EasyLua API which is to prevent accidental naming conflicts...
Definition: easylua.hpp:29
Float types.
Definition: easylua.hpp:45
static INLINE void pushTable(lua_State *lua, const char *key, const char *value, parameters...params)
This is one among a family of methods that push a table containing arbitrary values to the Lua stack...
Definition: easylua.hpp:605
static INLINE void pushParameters(lua_State *lua, const char *in, parameters...params)
This is one among a family of methods that push arbitrary values to the Lua stack.
Definition: easylua.hpp:500
static INLINE void pushTable(lua_State *lua, const char *key, const float &value, parameters...params)
This is one among a family of methods that push a table containing arbitrary values to the Lua stack...
Definition: easylua.hpp:547
static INLINE void pushTable(lua_State *lua, const char *key, const double &value, parameters...params)
This is one among a family of methods that push a table containing arbitrary values to the Lua stack...
Definition: easylua.hpp:567