From 5b61a8a5e03879e0de02e12033d2daa3d4379ea5 Mon Sep 17 00:00:00 2001 From: Benjamin Wrensch Date: Thu, 11 Apr 2024 09:07:16 +0200 Subject: [PATCH] [add] (lua) function for retrieving all tags set for a given tag component --- iolite_plugins/lua_plugin/init_state.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/iolite_plugins/lua_plugin/init_state.cpp b/iolite_plugins/lua_plugin/init_state.cpp index d05ea9f..6d16864 100644 --- a/iolite_plugins/lua_plugin/init_state.cpp +++ b/iolite_plugins/lua_plugin/init_state.cpp @@ -2768,6 +2768,18 @@ void script_init_state(sol::state& s) // @param tag_name string The name of the tag to remove. s["Tag"]["remove"] = io_component_tag->remove; + // @function get_tags + // @summary Returns all tags set for the given component. + // @param tag Ref The component to retrieve the tags from. + // @return table value Table containing all tags for the given component. + s["Tag"]["get_tags"] = [](io_ref_t tag) { + uint32_t num_tags; + io_component_tag->get_tags(tag, nullptr, &num_tags); + std::vector tags(num_tags); + io_component_tag->get_tags(tag, tags.data(), + &num_tags); + return tags; + }; }; s["FlipbookAnimation"] = s.create_table();