Fix the Data-returning variant of love.filesystem.read/File:read to return the size that was read. Now it's consistent with the string-returning variant.

This commit is contained in:
Alex Szpakowski
2019-07-31 19:24:17 -03:00
parent 56e3af1744
commit 459d31db7e
2 changed files with 6 additions and 20 deletions
+3 -10
View File
@@ -132,21 +132,14 @@ int w_File_read(lua_State *L)
return luax_ioError(L, "%s", e.what());
}
int nret = 0;
if (ctype == love::data::CONTAINER_DATA)
{
luax_pushtype(L, d.get());
nret = 1;
}
else
{
lua_pushlstring(L, (const char *) d->getData(), d->getSize());
lua_pushinteger(L, d->getSize());
nret = 2;
}
return nret;
lua_pushinteger(L, d->getSize());
return 2;
}
int w_File_write(lua_State *L)