diff --git a/sources/Component/IAControllable/IAControllableComponent.cpp b/sources/Component/IAControllable/IAControllableComponent.cpp index 47633d78..c91a75d9 100644 --- a/sources/Component/IAControllable/IAControllableComponent.cpp +++ b/sources/Component/IAControllable/IAControllableComponent.cpp @@ -7,15 +7,23 @@ #include #include "Map/MapInfo.hpp" +#include "Exception/Error.hpp" #include "Component/IAControllable/IAControllableComponent.hpp" namespace BBM { IAControllableComponent::IAControllableComponent(WAL::Entity &entity, std::string scriptPath) - : Component(entity), _scriptPath(scriptPath), _state(), registered(false) + : Component(entity), + _scriptPath(scriptPath), + registered(false), + _state() { - if (std::filesystem::exists(scriptPath)) - _state.dofile(scriptPath); + if (std::filesystem::exists(scriptPath)) { + _state.dofile(scriptPath); + } + else { + throw Error("Couldn't load lua script: " + scriptPath); + } }