mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-14 04:19:12 +00:00
lua: Return the correct frame in Frames_index() when the FramesObj is created from Range.frames
This commit is contained in:
parent
d3de65c9dd
commit
ed7209e7c6
@ -64,20 +64,19 @@ int Frames_index(lua_State* L)
|
||||
{
|
||||
auto obj = get_obj<FramesObj>(L, 1);
|
||||
auto sprite = obj->sprite(L);
|
||||
const int i = lua_tonumber(L, 2);
|
||||
int i = lua_tonumber(L, 2);
|
||||
|
||||
if (obj->frames) {
|
||||
if (i >= 1 && i <= obj->frames->size())
|
||||
push_sprite_frame(L, sprite, i-1);
|
||||
i = (*obj->frames)[i-1]+1;
|
||||
else
|
||||
lua_pushnil(L);
|
||||
}
|
||||
else {
|
||||
if (i >= 1 && i <= sprite->totalFrames())
|
||||
push_sprite_frame(L, sprite, i-1);
|
||||
else
|
||||
lua_pushnil(L);
|
||||
i = 0;
|
||||
}
|
||||
|
||||
if (i >= 1 && i <= sprite->totalFrames())
|
||||
push_sprite_frame(L, sprite, i-1);
|
||||
else
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user