#Multidimensional array limit?

7 messages · Page 1 of 1 (latest)

cyan dove
#

Multidimensional string array gets automaticlly set to [3000], even though it's set to be [5000][6]. I haven't found info about this online. Is there a limit for this?

chilly imp
#

there should be no limit but your ram

#

can you show more code/explain?

cyan dove
#

i get this error


goroutine 42 [running]:
main.escribir_tops_a_base_de_datos()
    /home/yogurt/Type_Bot/Type_Bot/test.go:23 +0xab
main.messageCreate(0xc0000c0700, 0xc0002b4058)
    /home/yogurt/Type_Bot/Type_Bot/main.go:691 +0x809a
github.com/bwmarrin/discordgo.messageCreateEventHandler.Handle(0xc00005efd0?, 0x61fa8a?, {0x70b860?, 0xc0002b4058?})
    /home/yogurt/work/pkg/mod/github.com/bwmarrin/[email protected]/eventhandlers.go:753 +0x38
created by github.com/bwmarrin/discordgo.(*Session).handle
    /home/yogurt/work/pkg/mod/github.com/bwmarrin/[email protected]/event.go:171 +0x16a
exit status 2

but the array is set to more than 3000

#

var tops [5000][6]string = [5000][6]string

weak hedge
#

If it's 3000 slots long, and you try to access slot 3000, you're out of bounds, because the first slot is not 1, it's 0, so the last slot isn't 3000, it's 2999

#

The data you're accessing does not have 5000 slots, or it would not give that error.