Godot Version
4.4 stable
Question
Sooo I really need a way to parse GDScript and then catch the errors if there are any, and if not, get the result which the code evaluates to.
I really tried to make this work with expressions. But expressions only support constructors and basic math operators. What I need, is the entire global scope, including the ability to create new things like CollisionShape2D.new() or BoxContainer.AlignmentMode.ALIGNMENT_BEGIN.
I have already tried something like creating a var script:GDScript = GDScript.new() and then going script.source_code = "extends Node\n\nfunc run():\n\treturn " + expression and that… works, but it crashes the game if the GDScript has compilation errors (which i seemingly cannot catch)
so that is where I am now.. it would be very and super crazy amazing if someone could point me in the right direction, if there even is one.