Augenbl1ck
(Augenbl1ck)
1
Simple Question: Is there a way to specify 2D arrays with different data types?
Like:
var PlayerList : [][]player = array{array{}}
Here we have two of the Player data type. But is it possible to define the first of type Player and the second of type int?
eldany.uy
(eldany.uy)
2
you can make a struct with arrays inside
even you can make struct arrays with arrays of structs inside and so on
Unreal just supports one dimensional native ARRAYS but with structs you can do whatever you need.
I believe you can use class
, struct
or tuple
to do that.
I don’t know why you need a 2D array here, but the easiest way would be using a tuple for sure, like this :
var PlayerData : [][]tuple(player, int) = array{}
if(Player := PlayerData[0][0](0), Value := PlayerData[0][0](1)):
# Do smth
But maybe you need to look into maps instead, I believe what you’re looking for is var PlayerData : [player]int = map{}
Hope it helps, if it doesn’t maybe you can explain better what you’re trying to achieve ?
1 Like
system
(system)
Closed
4
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.