Running code in code

This may seem odd, but is there any way to run code within code in UE?

I want to create a game where one of the things the user does is write code inside a text box, and I should be able to take this code and test it to see if it works well. I’ve done this in Unity C# but I couldn’t find a way to do it here (the game has to be in UE btw).

It can be any semi-famous programming language like Python, C# or C++, and I know I will have to cleanse code. Is there any way to do this without having to write a whole compiler or install too many other things? (it’s fine if I have to install a few modules)

i think theres actually a plugin that can do this for you? im not sure if its exactly what you are looking for, but it might be. check out skookumScript. from what i can tell, it allows you to update the game live through scripts.

but the problem is not implementing a code editor but triggering your mechanics.
For example, user wrote this.

void Main()
{
     var_loc location = (255, 283, 294);
     var_rot rotation = (0, 0, 0);
     var_size size = (1, 1, 1);
     SpawnActor(ClassA, location, rotation, size)
}

It should trigger SpawnActorFromClass function in your project with correct class.
There is no easy solution for that.

I think that I haven’t explained this properly. This is basically a game with a coding component (i.e. the player writes code for a coding problem, and the game has to test whether this code is the correct solution like LeetCode, HackerRank etc).

So I’m asking if there is any way to create an object or script inside the game that allows such functionality (i.e. compiles and runs the code that the player has entered)?