mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
Fix missing ByteData:clone and DataView:clone implementations.
Fixes #1754
This commit is contained in:
@@ -31,8 +31,19 @@ ByteData *luax_checkbytedata(lua_State *L, int idx)
|
||||
return luax_checktype<ByteData>(L, idx);
|
||||
}
|
||||
|
||||
int w_ByteData_clone(lua_State *L)
|
||||
{
|
||||
ByteData *t = luax_checkbytedata(L, 1);
|
||||
ByteData *c = nullptr;
|
||||
luax_catchexcept(L, [&](){ c = t->clone(); });
|
||||
luax_pushtype(L, c);
|
||||
c->release();
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const luaL_Reg w_ByteData_functions[] =
|
||||
{
|
||||
{ "clone", w_ByteData_clone },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
@@ -26,13 +26,24 @@ namespace love
|
||||
namespace data
|
||||
{
|
||||
|
||||
DataView *luax_checkdataView(lua_State *L, int idx)
|
||||
DataView *luax_checkdataview(lua_State *L, int idx)
|
||||
{
|
||||
return luax_checktype<DataView>(L, idx);
|
||||
}
|
||||
|
||||
int w_DataView_clone(lua_State *L)
|
||||
{
|
||||
DataView *t = luax_checkdataview(L, 1);
|
||||
DataView *c = nullptr;
|
||||
luax_catchexcept(L, [&](){ c = t->clone(); });
|
||||
luax_pushtype(L, c);
|
||||
c->release();
|
||||
return 1;
|
||||
}
|
||||
|
||||
static const luaL_Reg w_DataView_functions[] =
|
||||
{
|
||||
{ "clone", w_DataView_clone },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user