mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-06 03:39:51 +00:00
lua: add Palette() ctor to copy palettes
This commit is contained in:
parent
be8f026b91
commit
bd33333f15
@ -36,9 +36,14 @@ struct PaletteObj {
|
|||||||
|
|
||||||
int Palette_new(lua_State* L)
|
int Palette_new(lua_State* L)
|
||||||
{
|
{
|
||||||
|
if (auto pal2 = may_get_obj<PaletteObj>(L, 1)) {
|
||||||
|
push_new<PaletteObj>(L, nullptr, new Palette(*pal2->palette));
|
||||||
|
}
|
||||||
|
else {
|
||||||
int ncolors = lua_tointeger(L, 1);
|
int ncolors = lua_tointeger(L, 1);
|
||||||
push_new<PaletteObj>(L, nullptr,
|
push_new<PaletteObj>(L, nullptr,
|
||||||
new Palette(0, ncolors > 0 ? ncolors: 256));
|
new Palette(0, ncolors > 0 ? ncolors: 256));
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user