Skip to content

Instantly share code, notes, and snippets.

@Shilo
Created June 26, 2024 02:31
Show Gist options
  • Save Shilo/eaf01c95f3625a91d2a9052347cdd8e6 to your computer and use it in GitHub Desktop.
Save Shilo/eaf01c95f3625a91d2a9052347cdd8e6 to your computer and use it in GitHub Desktop.
Godot GDScript eval helper function.
func eval(code: String) -> Error:
var script := GDScript.new()
script.source_code = "static func _static_init(): pass; " + code.strip_edges().replace("\n", ";")
return script.reload()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment