LuaStack.h 930 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #pragma once
  2. #include "lua.hpp"
  3. #include "Types.h"
  4. #include "Vec2.h"
  5. #include "Vec3.h"
  6. #include "Mat4.h"
  7. #include "Quat.h"
  8. namespace crown
  9. {
  10. Vec2* next_vec2();
  11. Vec3* next_vec3();
  12. Mat4* next_mat4();
  13. Quat* next_quat();
  14. class LuaStack
  15. {
  16. public:
  17. LuaStack(lua_State* L);
  18. void push_bool(bool value);
  19. void push_int(int32_t value);
  20. void push_float(float value);
  21. void push_string(const char* str, size_t len);
  22. void push_vec2(Vec2* v);
  23. void push_vec3(Vec3* v);
  24. void push_mat4(Mat4* m);
  25. void push_quat(Quat* q);
  26. bool get_bool(int32_t index);
  27. int32_t get_int(int32_t index);
  28. float get_float(int32_t index);
  29. const char* get_string(int32_t index);
  30. Vec2* get_vec2(int32_t index);
  31. Vec3* get_vec3(int32_t index);
  32. Mat4* get_mat4(int32_t index);
  33. Quat* get_quat(int32_t index);
  34. private:
  35. lua_State* m_state;
  36. };
  37. } // namespace crown