mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
love.image.newImageData(w, h, format, rawbytes) can accept a Data object.
--HG-- branch : minor
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user