#If zig files are structs, can they ever be an enum?
1 messages · Page 1 of 1 (latest)
nope. they can only be structs
:|
sad days.
suppose i can always approximate an enum with a struct haha
ty for v fast answer!
for anyone in the future this is my workaround for a struct called layer, which defines a z index:
pub const Layer = struct {
z_index: i32,
};
fn layer(z_index: i32) Layer {
return .{
.z_index = z_index
};
}
pub const FLOOR = layer(0);
pub const ENTITIES = layer(1);
imo it's better to just declare a pub global enum in your file, and import it like @import("./Foo.zig").Foo