diff options
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/Component.hpp | 4 | ||||
-rw-r--r-- | src/components/Position.hpp | 14 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/components/Component.hpp b/src/components/Component.hpp index 84e860c..9c6b79d 100644 --- a/src/components/Component.hpp +++ b/src/components/Component.hpp @@ -19,7 +19,7 @@ #ifndef COMPONENT_HPP_ #define COMPONENT_HPP_ -#include "LuaBridge/LuaBridge.h" +#include "sol/sol.hpp" template <typename T> class Component @@ -27,7 +27,7 @@ class Component public: Component(){}; - virtual T FromLua(luabridge::LuaRef) = 0; + virtual T FromLua(sol::object) = 0; }; #endif//COMPONENT_HPP_ diff --git a/src/components/Position.hpp b/src/components/Position.hpp index aaa99f9..856b3d7 100644 --- a/src/components/Position.hpp +++ b/src/components/Position.hpp @@ -29,17 +29,17 @@ struct Position : Component<Position>, entityx::Component<Position> Position(float _x, float _y): x(_x), y(_y) {} Position(void){x = y = 0.0;} - Position FromLua(luabridge::LuaRef ref) + Position FromLua(sol::object ref) { - if (ref.isTable()){ - if (!ref["x"].isNil()) - this->x = ref["x"]; - if (!ref["y"].isNil()) - this->y = ref["y"]; + if (ref.get_type() == sol::type::table){ + sol::table tab = ref; + if (tab["x"] != nullptr) + this->x = tab["x"]; + if (tab["y"] != nullptr) + this->y = tab["y"]; } else { throw std::string("Position table not formatted properly"); } - return *this; } }; |