Skip to content

Commit

Permalink
[add] (lua) function for retrieving all tags set for a given tag comp…
Browse files Browse the repository at this point in the history
…onent
  • Loading branch information
begla committed Apr 11, 2024
1 parent d5da09a commit 5b61a8a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions iolite_plugins/lua_plugin/init_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<io_name_t> tags(num_tags);
io_component_tag->get_tags(tag, tags.data(),
&num_tags);
return tags;
};
};

s["FlipbookAnimation"] = s.create_table();
Expand Down

0 comments on commit 5b61a8a

Please sign in to comment.