diff --git a/src/app/script/layer_class.cpp b/src/app/script/layer_class.cpp index 9978e845b..c783dd367 100644 --- a/src/app/script/layer_class.cpp +++ b/src/app/script/layer_class.cpp @@ -49,6 +49,13 @@ int Layer_cel(lua_State* L) return 1; } +int Layer_get_id(lua_State* L) +{ + auto layer = get_docobj(L, 1); + lua_pushinteger(L, layer->id()); + return 1; +} + int Layer_get_sprite(lua_State* L) { auto layer = get_docobj(L, 1); @@ -383,6 +390,7 @@ const luaL_Reg Layer_methods[] = { }; const Property Layer_properties[] = { + { "id", Layer_get_id, nullptr }, { "sprite", Layer_get_sprite, nullptr }, { "parent", Layer_get_parent, Layer_set_parent }, { "layers", Layer_get_layers, nullptr }, diff --git a/src/app/script/sprite_class.cpp b/src/app/script/sprite_class.cpp index 69f236e84..3169e91bd 100644 --- a/src/app/script/sprite_class.cpp +++ b/src/app/script/sprite_class.cpp @@ -610,6 +610,13 @@ int Sprite_get_events(lua_State* L) return 1; } +int Sprite_get_id(lua_State* L) +{ + auto sprite = get_docobj(L, 1); + lua_pushinteger(L, sprite->id()); + return 1; +} + int Sprite_get_filename(lua_State* L) { auto sprite = get_docobj(L, 1); @@ -861,6 +868,7 @@ const luaL_Reg Sprite_methods[] = { }; const Property Sprite_properties[] = { + { "id", Sprite_get_id, nullptr }, { "filename", Sprite_get_filename, Sprite_set_filename }, { "isModified", Sprite_get_isModified, nullptr }, { "width", Sprite_get_width, Sprite_set_width },