mirror of
https://github.com/aseprite/aseprite.git
synced 2024-11-20 14:21:45 +00:00
[lua] Add negation operation (unary -) into Point() metatable
This commit is contained in:
parent
ad1a39714e
commit
0812ea8224
@ -86,6 +86,13 @@ int Point_tostring(lua_State* L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Point_unm(lua_State* L)
|
||||
{
|
||||
const auto pt = get_obj<gfx::Point>(L, 1);
|
||||
push_obj(L, -(*pt));
|
||||
return 1;
|
||||
}
|
||||
|
||||
int Point_get_x(lua_State* L)
|
||||
{
|
||||
const auto pt = get_obj<gfx::Point>(L, 1);
|
||||
@ -118,6 +125,7 @@ const luaL_Reg Point_methods[] = {
|
||||
{ "__gc", Point_gc },
|
||||
{ "__eq", Point_eq },
|
||||
{ "__tostring", Point_tostring },
|
||||
{ "__unm", Point_unm },
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user