diff --git a/Geo/GModelIO_Mesh.cpp b/Geo/GModelIO_Mesh.cpp
index 1b03e1e0af15ac01ee295bbfb285a2523d0928b9..ac22b7bd051dfccac171ba8b2b7963f73d74dcb0 100644
--- a/Geo/GModelIO_Mesh.cpp
+++ b/Geo/GModelIO_Mesh.cpp
@@ -3215,8 +3215,12 @@ int GModel::readDIFF(const std::string &name)
 }
 int GModel::readLUA(const std::string &name)
 {
+#if defined(HAVE_LUA)
 	int status = binding::instance()->readFile(name.c_str());
 	return status;
+#else
+	return 0;
+#endif
 }
 int GModel::writeDIFF(const std::string &name, bool binary, bool saveAll,
                       double scalingFactor)