love.image.newImageData(w, h, format, rawbytes) can accept a Data object.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2017-08-06 00:13:02 -03:00
parent 2dd6408d00
commit 9b6aa777ad
+7 -1
View File
@@ -56,7 +56,13 @@ int w_newImageData(lua_State *L)
size_t numbytes = 0;
const char *bytes = nullptr;
if (!lua_isnoneornil(L, 4))
if (luax_istype(L, 4, Data::type))
{
Data *data = luax_checkdata(L, 4);
bytes = (const char *) data->getData();
numbytes = data->getSize();
}
else if (!lua_isnoneornil(L, 4))
bytes = luaL_checklstring(L, 4, &numbytes);
ImageData *t = nullptr;