diff options
Diffstat (limited to 'src/components/Position.hpp')
-rw-r--r-- | src/components/Position.hpp | 14 |
1 files changed, 7 insertions, 7 deletions
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; } }; |