Browse Source

Rename love.sensor.isAvailable to love.sensor.hasSensor.

Miku AuahDark 2 years ago
parent
commit
32bebfd1fc

+ 1 - 1
src/modules/sensor/Sensor.h

@@ -49,7 +49,7 @@ public:
 	/**
 	/**
 	 * Check the availability of the sensor.
 	 * Check the availability of the sensor.
 	 **/
 	 **/
-	virtual bool isAvailable(SensorType type) = 0;
+	virtual bool hasSensor(SensorType type) = 0;
 
 
 	/**
 	/**
 	 * Check if the sensor is enabled.
 	 * Check if the sensor is enabled.

+ 1 - 1
src/modules/sensor/sdl/Sensor.cpp

@@ -49,7 +49,7 @@ const char *Sensor::getName() const
 	return "love.sensor.sdl";
 	return "love.sensor.sdl";
 }
 }
 
 
-bool Sensor::isAvailable(SensorType type)
+bool Sensor::hasSensor(SensorType type)
 {
 {
 	for (int i = 0; i < SDL_NumSensors(); i++)
 	for (int i = 0; i < SDL_NumSensors(); i++)
 	{
 	{

+ 1 - 1
src/modules/sensor/sdl/Sensor.h

@@ -46,7 +46,7 @@ public:
 	// Implements Module.
 	// Implements Module.
 	const char *getName() const override;
 	const char *getName() const override;
 
 
-	bool isAvailable(SensorType type) override;
+	bool hasSensor(SensorType type) override;
 	bool isEnabled(SensorType type) override;
 	bool isEnabled(SensorType type) override;
 	void setEnabled(SensorType type, bool enable) override;
 	void setEnabled(SensorType type, bool enable) override;
 	std::vector<float> getData(SensorType type) override;
 	std::vector<float> getData(SensorType type) override;

+ 3 - 4
src/modules/sensor/wrap_Sensor.cpp

@@ -40,11 +40,11 @@ inline Sensor::SensorType luax_checksensortype(lua_State *L, int i)
 	return type;
 	return type;
 }
 }
 
 
-static int w_isAvailable(lua_State *L)
+static int w_hasSensor(lua_State *L)
 {
 {
 	Sensor::SensorType type = luax_checksensortype(L, 1);
 	Sensor::SensorType type = luax_checksensortype(L, 1);
 
 
-	lua_pushboolean(L, instance()->isAvailable(type));
+	lua_pushboolean(L, instance()->hasSensor(type));
 	return 1;
 	return 1;
 }
 }
 
 
@@ -90,8 +90,7 @@ static int w_getName(lua_State *L)
 
 
 static const luaL_Reg functions[] =
 static const luaL_Reg functions[] =
 {
 {
-	{ "isAvailable", w_isAvailable },
-	{ "hasSensor", w_isAvailable },
+	{ "hasSensor", w_hasSensor },
 	{ "isEnabled", w_isEnabled },
 	{ "isEnabled", w_isEnabled },
 	{ "setEnabled", w_setEnabled },
 	{ "setEnabled", w_setEnabled },
 	{ "getData", w_getData },
 	{ "getData", w_getData },