Evaluation bug?
Posted: Wed Aug 15, 2018 9:14 am
I'm seeing what looks like a condition evaluation bug. A simple example:
Where False() and True() are defined in my Unity script as:
When the condition is evaluated, I see "This returns false." followed by "This returns trues."
LUA is supposed to support short-circuit evaluation, so the correct behavior should be that True() is never evaluated. (My actual use case is combining an array bounds check with an array look up to avoid errors.)
Is this a bug or am I missing something?
Code: Select all
False() and True()
Code: Select all
public bool True()
{
Debug.Log("This returns true.");
return true;
}
public bool False()
{
Debug.Log("This returns false.");
return false;
}
LUA is supposed to support short-circuit evaluation, so the correct behavior should be that True() is never evaluated. (My actual use case is combining an array bounds check with an array look up to avoid errors.)
Is this a bug or am I missing something?