single returns nil when empty

This commit is contained in:
harper
2026-10-10 12:07:33 -07:00
parent 294ffb70cc
commit de088f69e6
+1 -6
View File
@@ -44,7 +44,7 @@ single :: proc(storage: ^Storage($T)) -> (Entity, ^T) {
for i, &v in slice(storage) {
return i, &v
}
return Entity{}, new(T)
return 0, nil
}
// get component of type from entity
@@ -54,8 +54,3 @@ get_component :: proc(entity: Entity, storage: ^Storage($T)) -> ^T {
}
return new(T)
}
// alias for direct mutation access
get_component_with_ref :: proc(entity: Entity, storage: ^Storage($T)) -> ^T {
return get_component(entity, storage)
}