diff --git a/libraries/AP_RangeFinder/AP_RangeFinder_Lua.cpp b/libraries/AP_RangeFinder/AP_RangeFinder_Lua.cpp
index b01842ef2c..cd02457513 100644
--- a/libraries/AP_RangeFinder/AP_RangeFinder_Lua.cpp
+++ b/libraries/AP_RangeFinder/AP_RangeFinder_Lua.cpp
@@ -13,11 +13,13 @@
along with this program. If not, see .
*/
+#include "AP_RangeFinder_config.h"
+
+#if AP_RANGEFINDER_LUA_ENABLED
+
#include "AP_RangeFinder_Lua.h"
#include
-#if AP_SCRIPTING_ENABLED
-
// constructor
AP_RangeFinder_Lua::AP_RangeFinder_Lua(RangeFinder::RangeFinder_State &_state, AP_RangeFinder_Params &_params) :
AP_RangeFinder_Backend(_state, _params)
@@ -49,4 +51,4 @@ void AP_RangeFinder_Lua::update(void)
}
}
-#endif
+#endif // AP_RANGEFINDER_LUA_ENABLED