Improved error checking for some enum strings (resolves issue #690).

Also moved love.audio.newSource from Lua code into C++ code
This commit is contained in:
Alex Szpakowski
2013-08-03 21:24:43 -03:00
parent 0c053e09d4
commit a4ff39e0d4
9 changed files with 44 additions and 200 deletions
@@ -433,8 +433,9 @@ int w_newSpriteBatch(lua_State *L)
SpriteBatch::UsageHint usage = SpriteBatch::USAGE_DYNAMIC;
if (lua_gettop(L) > 2)
{
if (!SpriteBatch::getConstant(luaL_checkstring(L, 3), usage))
usage = SpriteBatch::USAGE_DYNAMIC;
const char *usagestr = luaL_checkstring(L, 3);
if (!SpriteBatch::getConstant(usagestr, usage))
return luaL_error(L, "Invalid SpriteBatch usage: %s", usagestr);
}
SpriteBatch *t = NULL;
try