Is there a way to inline convert a string datatype to a message data type?
TrueInteractText : string = "True"
TrueButton.SetInteractionText(--->TrueInteractText<---) #This function requires a message datatype as input.
Is there a way to inline convert a string datatype to a message data type?
TrueInteractText : string = "True"
TrueButton.SetInteractionText(--->TrueInteractText<---) #This function requires a message datatype as input.
Hi @BrianDickman:
Currently the message
type is limited to requiring a string literal for initialization. You’d have to write:
TrueMessage<localizes>:message = "True"
TrueButton.SetInteractionText(TrueMessage)
Let us know if there’s a different use case that you have that this doesn’t solve.
Hi, is this an outdated answer perhaps? If I try this code I get an error:
“Attribute localizes is not allowed on local variables.”
TrueMessage<localizes>:message = "True"
Popup.SetDescriptionText(TrueMessage)
If I take out <localizes>
I get a different error:
This variable expects to be initialized with a value of type message, but this initializer is an incompatible value of type []char.
Sorry for the really late reply here - this isn’t outdated. The compiler is telling you that you cannot have a message
in areas where they cannot be qualified with a full Verse path. That is to say:
Foo():void=
A<localizes>:message = "test message"
Is not allowed, since A
is a local variable to Foo
. However, you can still do something like:
Foo<public>:=module:
A<public><localizes>:message = "test message"