From 0a558aabcfd4fb1dd8f95d8c22cc0652d038ae46 Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 6 Dec 2018 12:31:46 -0300 Subject: [PATCH] lua: Add Layer:cel() function --- src/app/script/layer_class.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/app/script/layer_class.cpp b/src/app/script/layer_class.cpp index 612e63ffe..0a4ca6923 100644 --- a/src/app/script/layer_class.cpp +++ b/src/app/script/layer_class.cpp @@ -35,6 +35,17 @@ int Layer_eq(lua_State* L) return 1; } +int Layer_cel(lua_State* L) +{ + auto layer = get_docobj(L, 1); + auto cel = layer->cel(get_frame_number_from_arg(L, 2)); + if (cel) + push_docobj(L, cel); + else + lua_pushnil(L); + return 1; +} + int Layer_get_sprite(lua_State* L) { auto layer = get_docobj(L, 1); @@ -245,6 +256,7 @@ int Layer_set_isExpanded(lua_State* L) const luaL_Reg Layer_methods[] = { { "__eq", Layer_eq }, + { "cel", Layer_cel }, { nullptr, nullptr } };