mirror of
https://github.com/love2d/love.git
synced 2026-08-20 12:40:20 +02:00
Improved some error message text
This commit is contained in:
@@ -464,7 +464,7 @@ void luax_pushtype(lua_State *L, const char *name, bits flags, love::Object *dat
|
|||||||
|
|
||||||
bool luax_istype(lua_State *L, int idx, love::bits type)
|
bool luax_istype(lua_State *L, int idx, love::bits type)
|
||||||
{
|
{
|
||||||
if (lua_isuserdata(L, idx) == 0)
|
if (lua_type(L, idx) != LUA_TUSERDATA)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return ((((Proxy *)lua_touserdata(L, idx))->flags & type) == type);
|
return ((((Proxy *)lua_touserdata(L, idx))->flags & type) == type);
|
||||||
|
|||||||
@@ -401,7 +401,7 @@ extern "C" { // Also called from luasocket
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
T *luax_checktype(lua_State *L, int idx, const char *name, love::bits type)
|
T *luax_checktype(lua_State *L, int idx, const char *name, love::bits type)
|
||||||
{
|
{
|
||||||
if (lua_isuserdata(L, idx) == 0)
|
if (lua_type(L, idx) != LUA_TUSERDATA)
|
||||||
luax_typerror(L, idx, name);
|
luax_typerror(L, idx, name);
|
||||||
|
|
||||||
Proxy *u = (Proxy *)lua_touserdata(L, idx);
|
Proxy *u = (Proxy *)lua_touserdata(L, idx);
|
||||||
|
|||||||
@@ -1122,8 +1122,9 @@ int w_line(lua_State *L)
|
|||||||
args = lua_objlen(L, 1);
|
args = lua_objlen(L, 1);
|
||||||
is_table = true;
|
is_table = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args % 2 != 0)
|
if (args % 2 != 0)
|
||||||
return luaL_error(L, "Number of vertices must be a multiple of two");
|
return luaL_error(L, "Number of vertex components must be a multiple of two");
|
||||||
else if (args < 4)
|
else if (args < 4)
|
||||||
return luaL_error(L, "Need at least two vertices to draw a line");
|
return luaL_error(L, "Need at least two vertices to draw a line");
|
||||||
|
|
||||||
@@ -1224,7 +1225,7 @@ int w_polygon(lua_State *L)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (args % 2 != 0)
|
if (args % 2 != 0)
|
||||||
return luaL_error(L, "Number of vertices must be a multiple of two");
|
return luaL_error(L, "Number of vertex components must be a multiple of two");
|
||||||
else if (args < 6)
|
else if (args < 6)
|
||||||
return luaL_error(L, "Need at least three vertices to draw a polygon");
|
return luaL_error(L, "Need at least three vertices to draw a polygon");
|
||||||
|
|
||||||
|
|||||||
@@ -93,8 +93,9 @@ EdgeShape *Physics::newEdgeShape(float x1, float y1, float x2, float y2)
|
|||||||
int Physics::newPolygonShape(lua_State *L)
|
int Physics::newPolygonShape(lua_State *L)
|
||||||
{
|
{
|
||||||
int argc = lua_gettop(L);
|
int argc = lua_gettop(L);
|
||||||
if (argc%2 != 0)
|
if (argc % 2 != 0)
|
||||||
return luaL_error(L, "Number of vertices must be a multiple of two.");
|
return luaL_error(L, "Number of vertex components must be a multiple of two.");
|
||||||
|
|
||||||
// 3 to 8 (b2_maxPolygonVertices) vertices
|
// 3 to 8 (b2_maxPolygonVertices) vertices
|
||||||
int vcount = argc / 2;
|
int vcount = argc / 2;
|
||||||
if (vcount < 3)
|
if (vcount < 3)
|
||||||
|
|||||||
Reference in New Issue
Block a user