mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-14 04:19:12 +00:00
lua: add __eq to some other metatables
This commit is contained in:
parent
4a143cb902
commit
eb946438f5
@ -21,6 +21,14 @@ using namespace doc;
|
||||
|
||||
namespace {
|
||||
|
||||
int Cel_eq(lua_State* L)
|
||||
{
|
||||
const auto a = get_ptr<Cel>(L, 1);
|
||||
const auto b = get_ptr<Cel>(L, 2);
|
||||
lua_pushboolean(L, a->id() == b->id());
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Cel_get_sprite(lua_State* L)
|
||||
{
|
||||
auto cel = get_ptr<Cel>(L, 1);
|
||||
@ -57,6 +65,7 @@ int Cel_get_bounds(lua_State* L)
|
||||
}
|
||||
|
||||
const luaL_Reg Cel_methods[] = {
|
||||
{ "__eq", Cel_eq },
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
|
||||
|
@ -24,6 +24,14 @@ using namespace doc;
|
||||
|
||||
namespace {
|
||||
|
||||
int Layer_eq(lua_State* L)
|
||||
{
|
||||
const auto a = get_ptr<Layer>(L, 1);
|
||||
const auto b = get_ptr<Layer>(L, 2);
|
||||
lua_pushboolean(L, a->id() == b->id());
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Layer_get_sprite(lua_State* L)
|
||||
{
|
||||
auto layer = get_ptr<Layer>(L, 1);
|
||||
@ -88,6 +96,7 @@ int Layer_set_opacity(lua_State* L)
|
||||
}
|
||||
|
||||
const luaL_Reg Layer_methods[] = {
|
||||
{ "__eq", Layer_eq },
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
|
||||
|
@ -50,6 +50,14 @@ int Point_gc(lua_State* L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Point_eq(lua_State* L)
|
||||
{
|
||||
const auto a = get_obj<gfx::Point>(L, 1);
|
||||
const auto b = get_obj<gfx::Point>(L, 2);
|
||||
lua_pushboolean(L, *a == *b);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Point_get_x(lua_State* L)
|
||||
{
|
||||
const auto pt = get_obj<gfx::Point>(L, 1);
|
||||
@ -80,6 +88,7 @@ int Point_set_y(lua_State* L)
|
||||
|
||||
const luaL_Reg Point_methods[] = {
|
||||
{ "__gc", Point_gc },
|
||||
{ "__eq", Point_eq },
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
|
||||
|
@ -56,6 +56,14 @@ int Rectangle_gc(lua_State* L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Rectangle_eq(lua_State* L)
|
||||
{
|
||||
const auto a = get_obj<gfx::Rect>(L, 1);
|
||||
const auto b = get_obj<gfx::Rect>(L, 2);
|
||||
lua_pushboolean(L, *a == *b);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Rectangle_get_x(lua_State* L)
|
||||
{
|
||||
const auto rc = get_obj<gfx::Rect>(L, 1);
|
||||
@ -121,6 +129,7 @@ int Rectangle_get_isEmpty(lua_State* L)
|
||||
|
||||
const luaL_Reg Rectangle_methods[] = {
|
||||
{ "__gc", Rectangle_gc },
|
||||
{ "__eq", Rectangle_eq },
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
|
||||
|
@ -50,6 +50,14 @@ int Size_gc(lua_State* L)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Size_eq(lua_State* L)
|
||||
{
|
||||
const auto a = get_obj<gfx::Size>(L, 1);
|
||||
const auto b = get_obj<gfx::Size>(L, 2);
|
||||
lua_pushboolean(L, *a == *b);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Size_get_width(lua_State* L)
|
||||
{
|
||||
const auto sz = get_obj<gfx::Size>(L, 1);
|
||||
@ -84,6 +92,7 @@ int Size_set_height(lua_State* L)
|
||||
|
||||
const luaL_Reg Size_methods[] = {
|
||||
{ "__gc", Size_gc },
|
||||
{ "__eq", Size_eq },
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
|
||||
|
@ -22,6 +22,14 @@ using namespace doc;
|
||||
|
||||
namespace {
|
||||
|
||||
int Slice_eq(lua_State* L)
|
||||
{
|
||||
const auto a = get_ptr<Slice>(L, 1);
|
||||
const auto b = get_ptr<Slice>(L, 2);
|
||||
lua_pushboolean(L, a->id() == b->id());
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Slice_get_sprite(lua_State* L)
|
||||
{
|
||||
auto slice = get_ptr<Slice>(L, 1);
|
||||
@ -81,6 +89,7 @@ int Slice_get_pivot(lua_State* L)
|
||||
}
|
||||
|
||||
const luaL_Reg Slice_methods[] = {
|
||||
{ "__eq", Slice_eq },
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
|
||||
|
@ -23,6 +23,14 @@ using namespace doc;
|
||||
|
||||
namespace {
|
||||
|
||||
int Tag_eq(lua_State* L)
|
||||
{
|
||||
const auto a = get_ptr<FrameTag>(L, 1);
|
||||
const auto b = get_ptr<FrameTag>(L, 2);
|
||||
lua_pushboolean(L, a->id() == b->id());
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Tag_get_fromFrame(lua_State* L)
|
||||
{
|
||||
auto tag = get_ptr<FrameTag>(L, 1);
|
||||
@ -104,6 +112,7 @@ int Tag_set_aniDir(lua_State* L)
|
||||
}
|
||||
|
||||
const luaL_Reg Tag_methods[] = {
|
||||
{ "__eq", Tag_eq },
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user