public bool True()
{
Debug.Log("This returns true.");
return true;
}
public bool False()
{
Debug.Log("This returns false.");
return false;
}
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.)
It appears that LuaInterpreter, the native C# Lua implementation used in the Dialogue System, doesn't do short-circuit evaluation. I'll see if I can fix this in version 2.0.4.
I just implemented the fix for 2.x. It'll be in 2.0.4.
What version of Unity are you using? I'll send you a fix for 1.x. The fix will also be in version 1.8.6, which won't come out for a while. Version 1.x is only getting bug fixes. Currently the only fix is this one. If no other bug reports come in, I'll build and release 1.8.6 at the end of September.