right now, I am creating an enumeration from a list of types:
fn RegisterComponents(comptime types: anytype) type {
const int_type = std.math.IntFittingRange(0, types.len - 1);
var enum_fields: [types.len][]const u8 = undefined;
var field_values: [types.len]int_type = undefined;
for (types, 0..) |T, i| {
enum_fields[i] = @typeName(T);
field_values[i] = i;
}
return @Enum(int_type, .exhaustive, &enum_fields, &field_values);
}
const Health = struct { health: f32 };
const Components = RegisterComponents(.{Health});
pub fn main() !void {
inline for (std.meta.fields(Components)) |field| {
std.debug.print("{s} (value: {d})\n", .{ field.name, field.value });
}
}
but in this case, the enumeration has the name main.Health, when ideally I want it to just be Health, is there anyway to get the name without the "namespace"?