Mercurial > games > semicongine
changeset 1293:b94b648df33c
add: nicer string output for integer vecs
author | sam <sam@basx.dev> |
---|---|
date | Sun, 04 Aug 2024 20:50:38 +0700 |
parents | 5de466f5f087 |
children | 9ff18be62a1e |
files | semicongine/core/vector.nim |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/semicongine/core/vector.nim Sun Aug 04 00:58:00 2024 +0700 +++ b/semicongine/core/vector.nim Sun Aug 04 20:50:38 2024 +0700 @@ -105,7 +105,10 @@ func toVecString[T: TVec](value: T): string = var items: seq[string] for item in value: - items.add(&"{item.float:.5f}") + when elementType(value) is SomeFloat: + items.add(&"{item:.5f}") + else: + items.add(&"{item}") & "(" & join(items, " ") & ")" func `$`*(v: TVec1[SomeNumber]): string = toVecString[TVec1[SomeNumber]](v)