is there no way for structs to have custom constructors? I have a struct that has a bunch of integers and I’d like to be able to change the value of one of the properties.
With verse structs cannot have functions but it also tells me that doing any set
on its members is not allowed as structs do not allow var
. Does anyone know if there’s syntax to at least make a custom ctor? Initialize list doesn’t seem to work either
this is my struct
my_player_struct := struct<concrete>()
{
Player : ?player = false
LivesLeft : int = 3
CurrentInstanceActive : int = -1
}
doing my_player_struct { option{APlayerObject}, 42, 0 }
doesn’t work , so I’m wondering if I have any options here. Doing it via () doesn’t work either as it says it’s not compatible with tuple
and docs say constructor is for class only, so not really sure if/how we’re supposed to work with struct data changing. I understand immutability - this is for an array and have no issues recreating the array after the change I just want to be able to have structs with different values besides their defaults changed at runtime, not via @editable