mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-29 03:32:48 +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 ncolors = lua_tointeger(L, 1);
|
||||
push_new<PaletteObj>(L, nullptr,
|
||||
new Palette(0, ncolors > 0 ? ncolors: 256));
|
||||
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);
|
||||
push_new<PaletteObj>(L, nullptr,
|
||||
new Palette(0, ncolors > 0 ? ncolors: 256));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user