#looping over an array list of struct items, and can't recognize struct methods.

1 messages · Page 1 of 1 (latest)

trail arch
#

you are iterating over the len

#

not the items

#

oh wait

#

misread

#

what is the type of the items?

drowsy heath
#

Are you sure they're the same type? Left image says *chunk, while the right says *Chunk

barren quartz
#

just do c.create()

#

idk why you dereference there

#

considering create takes a reference

drowsy heath
#

That too, but I don't see why it would cause that error

barren quartz
#

then what raccoon said is correct

#

or alternatively your create function is not inside the Chunk container

#

btw you can just do for (Renderer.meshes_need_updating) |c|

#

try for (Renderer.meshes_need_updating) |*c|

#

c.create()

#

my bad

#

can I see more context for the create() method?

#

I mean around it like the struct definition

#

I wonder why it thinks you have a type chunk

trail arch
#

what is the signature of the method you are calling from?

barren quartz
#

bit silly but how do you Import Chunk?

#

I think I know why

#

you might have const Chunk = @import("chunk.zig")

#

instead of const Chunk = @import("chunk.zig").Chunk

trail arch
#

hehe

#

it happens to the best of us

drowsy heath
#

Just make chunk.zig a file struct and you can use the import directly