Is there have die function ?

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

I want to put some check point in my code.
And the script will die in compile time if check fail.
something like this:

static func ziper(ziper_function: FuncRef, left_array:Array, right_array:Array)->Array:
    var zipered_array: Array = []
    if left_array.size != right_array:
        die("array size different")
    for i in range(left_array.size()):
        zipered_array.append(ziper_function.call_func(left_array[i], right_array[i]))
    return 

How can I do it?

Are you looking for assert?
See here: https://docs.godotengine.org/en/3.1/classes/class_@gdscript.html#class-gdscript-method-assert

EDIT: Just saw you mention at compile time, sorry. I don’t know of anything there.

omggomb | 2019-08-16 14:27