Page 1 of 1

Multiple ANDs executed one by one from left to right?

Posted: Wed Jun 11, 2025 2:56 pm
by Bugala
At least currently, this code works:

Code: Select all

mytable = {}

If HasItem(mytable, "test") = True And Mytable.test = 1
	DebugPrint("do the stuff")
Else
	DebugPrint("dont do the stuff")
endif
But will this also work in the future? As in, if using multiple AND conditions, is it always so that they will be executed one by one, from left to right, ignoring the rest if one of them is not true.

As in this case, if it started checking if Mytable.test = 1, it would fail, since it couldn't access Mytable.Test, since it doesn't exist. However, in this case, the previous test is to check if Mytable has item "test" in it, and as that fails, then it doesn't check the other one either.

Is this the default way Hollywood is supposed to work, as in, this is how it will work in future versions too?

Re: Multiple ANDs executed one by one from left to right?

Posted: Sun Jun 15, 2025 4:12 pm
by airsoftsoftwair
Sure, that is called short-circuit evaluation and of course this is guaranteed to work forever. Changing such fundamental things would break lots of scripts so of course this will never behave in any other way.