From ecec485fe6c7e3858fcb786dcea32a8f28671b51 Mon Sep 17 00:00:00 2001
From: David Capello <david@igarastudio.com>
Date: Thu, 22 Nov 2018 15:05:21 -0300
Subject: [PATCH] lua: Add Site.frameNumber

---
 src/app/script/site_class.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/app/script/site_class.cpp b/src/app/script/site_class.cpp
index 758b7e4d9..985d3c990 100644
--- a/src/app/script/site_class.cpp
+++ b/src/app/script/site_class.cpp
@@ -53,6 +53,16 @@ int Site_get_cel(lua_State* L)
 }
 
 int Site_get_frame(lua_State* L)
+{
+  auto site = get_obj<Site>(L, 1);
+  if (site->sprite())
+    push_sprite_frame(L, site->sprite(), site->frame());
+  else
+    lua_pushnil(L);
+  return 1;
+}
+
+int Site_get_frameNumber(lua_State* L)
 {
   auto site = get_obj<Site>(L, 1);
   lua_pushinteger(L, site->frame()+1);
@@ -78,6 +88,7 @@ const Property Site_properties[] = {
   { "layer", Site_get_layer, nullptr },
   { "cel", Site_get_cel, nullptr },
   { "frame", Site_get_frame, nullptr },
+  { "frameNumber", Site_get_frameNumber, nullptr },
   { "image", Site_get_image, nullptr },
   { nullptr, nullptr, nullptr }
 };