Xkonti / NimForUE-docs

Documentation page for NimForUE Unreal Engine plugin
https://nimforue.pages.dev
MIT License
3 stars 2 forks source link

Explain how to work with strings, FString, FName and FText #23

Open Xkonti opened 1 month ago

Xkonti commented 1 month ago

Having a quick reference for those common types would be very helpful.

Notes

AI generated overly-lengthy explanation

[!CAUTION] This needs to be verified!

FString

Use cases:

Memory/Performance:

Special functionality:

In NimForUE:

let myString: FString = "Hello, World!"

FName

Use cases:

Memory/Performance:

Special functionality:

In NimForUE:

let myName: FName = n"MyIdentifier"  # Note the 'n' prefix

FText

Use cases:

Memory/Performance:

Special functionality:

In NimForUE:

let myText: FText = "Hello, World!".toText()

Special NimForUE considerations

In NimForUE, you'll often use these types when interacting with Unreal Engine's systems. Remember that NimForUE provides some convenience methods for working with these types, like the n prefix for creating FNames and the toText() method for creating FTexts.

Also, when defining properties in your NimForUE classes, you'll use these types directly:

uClass AMyActor of AActor:
  uprops(EditAnywhere, BlueprintReadWrite):
    stringProp: FString
    nameProp: FName
    textProp: FText
rpatel0022 commented 1 month ago

Would you like this to be updated on the readme?

Xkonti commented 1 month ago

@rpatel0022 This definitely wouldn't go into readme. This sounds like a separate page in a new Reference section.