From 8043af1df6ee747cb98a9c7b6b652064895417ed Mon Sep 17 00:00:00 2001 From: Benjamin Wrensch Date: Sun, 9 Jun 2024 09:47:02 +0200 Subject: [PATCH] [add] (api) rename function to entity interface --- iolite_c_api/iolite_api.h | 8 +++++--- iolite_plugins/lua_plugin/init_state.cpp | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/iolite_c_api/iolite_api.h b/iolite_c_api/iolite_api.h index 37ecf29..cbff5c5 100644 --- a/iolite_c_api/iolite_api.h +++ b/iolite_c_api/iolite_api.h @@ -2722,12 +2722,14 @@ struct io_entity_i // NOLINT // Gets the name of the given entity. const char* (*get_name)(io_ref_t entity); - // Gets the UUID of the given entity. - io_uuid_t (*get_uuid)(io_ref_t entity); - + // Renames the given entity. + void (*rename)(io_ref_t entity, const char* name); // Returns the linear memory containing all the names for all active entities. io_name_t* (*get_name_memory)(); + // Gets the UUID of the given entity. + io_uuid_t (*get_uuid)(io_ref_t entity); + // Finds the first entity with the given name. io_ref_t (*find_first_entity_with_name)(const char* name); // Finds the first entity with the given UUID. diff --git a/iolite_plugins/lua_plugin/init_state.cpp b/iolite_plugins/lua_plugin/init_state.cpp index 51f2d82..35d1c81 100644 --- a/iolite_plugins/lua_plugin/init_state.cpp +++ b/iolite_plugins/lua_plugin/init_state.cpp @@ -1933,6 +1933,11 @@ void script_init_state(sol::state& s) // @param entity Ref The entity to check. // @return string value The name of the given entity. s["Entity"]["get_name"] = io_entity->get_name; + // @function rename + // @summary Renames the given entity. + // @param entity Ref The entity to rename. + // @param name string The new name of the entity. + s["Entity"]["rename"] = io_entity->rename; // @function find_first_entity_with_name // @summary Finds the first entity with the given name.