calling the a function that is too short for GD script

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By BruhChest

Hi, so basically I am trying to call a function in my code for loading, (extremely simple, right?), but for some reason it’s not long enough to be called?

func _pressed():
load()

func load():
#^this is the func I am trying to call

What does “not long enough to be called” mean? What actual problem are you having? How about showing your whole script? Please provide more information about your setup.

kidscancode | 2020-09-27 18:22

:bust_in_silhouette: Reply From: Tim Martin

Not sure what “not long enough to be called” means here. But could your problem be that load is a reserved function name?

Try calling your function something else.

:bust_in_silhouette: Reply From: jonbonazza

Assuming it’s not a copy/paste error, your script above is invalid syntax. The indentation is incorrect. Try

func _pressed():
    load()

func load():
    pass

EDIT: Also, as Tim Martin alluded to in another answer, you should generally shy away from shadowing built in functions and member variables.