Slate UI TextBlock, Text_Lambda to update the Text?

I have a Slate widget that I create like this:

  void SetUpWidget()
    	FText SlateHUDText = FText::FromString("This is the first text");
    	FLevelEditorModule& LevelEditor = FModuleManager::GetModuleChecked<FLevelEditorModule>(TEXT("LevelEditor"));
    	TSharedPtr<ILevelViewport> LViewport = LevelEditor.GetFirstActiveViewport();
    	TSharedRef<SWidget> NewWidget = SNew(SOverlay)
    		+ SOverlay::Slot()
    		.Font(FSlateFontInfo("Veranda", 16))
    		//.Text_Lambda() // HOW TO?

I have another function that updates a string variable on Tick. What I would like to do is BIND the string variable to the TSharedRef TextBlock, so that it updates every time the variable does. Is this done with the Text_Lambda attribute? Or is there another way?


Ah, solved it.


FString displayStr = "this string";

//from above code

.Text_Lambda([this]()->FText {return FText::FromString(displayStr); })

Lamda is new C++ feature from C++11 so not all C++ tutorials teach that Lambda expressions (since C++11) -