Automatically deduce the type in luax_checktype, luax_getmodule, luax_optmodule and luax_totype

--HG--
branch : dynamiccore2
This commit is contained in:
Bart van Strien
2016-11-13 17:13:40 +01:00
parent 4a0a90e511
commit 7dd960619d
61 changed files with 120 additions and 98 deletions
+3 -3
View File
@@ -43,7 +43,7 @@ int luax_ioError(lua_State *L, const char *fmt, ...)
File *luax_checkfile(lua_State *L, int idx)
{
return luax_checktype<File>(L, idx, love::filesystem::File::type);
return luax_checktype<File>(L, idx);
}
int w_File_getSize(lua_State *L)
@@ -152,7 +152,7 @@ int w_File_write(lua_State *L)
{
try
{
love::Data *data = luax_totype<love::Data>(L, 2, love::Data::type);
love::Data *data = luax_totype<love::Data>(L, 2);
result = file->write(data, luaL_optinteger(L, 3, data->getSize()));
}
catch (love::Exception &e)
@@ -227,7 +227,7 @@ int w_File_lines_i(lua_State *L)
int linesize = 0;
bool newline = false;
File *file = luax_checktype<File>(L, lua_upvalueindex(1), File::type);
File *file = luax_checktype<File>(L, lua_upvalueindex(1));
// Only accept read mode at this point.
if (file->getMode() != File::MODE_READ)