Odin
Odin copied to clipboard
Untyped value to array type
bobby :: proc() -> [2]f32 {
t :: glsl.vec3{0, 1, 0}
return (t.x >= 0.0) ? 1 : -1, (t.y >= 0.0) ? 1 : -1 //Cannot convert untyped value '(t.x >= 0.0) ? 1 : -1' to '[2]f32' from 'untyped integer'
}
As discussed in Discord.
Because you're trying to fill [2]f32 with either 1 or -1, and then you have a second ternary for a second return value the proc doesn't have, this was never going to work. { .. } solves it.
bobby :: proc() -> [2]f32 {
t :: glsl.vec3{0, 1, 0}
return {(t.x >= 0.0) ? 1 : -1, (t.y >= 0.0) ? 1 : -1} //Cannot convert untyped value '(t.x >= 0.0) ? 1 : -1' to '[2]f32' from 'untyped integer'
}
Thanks. I was expecting the constant system to aid me here, given that x : [2]f32 = 1 works.