The idea is to execute certain healing patterns if both of my character's legs are damaged. I want to use something like:
Code: Select all
if (affLegLeftDamage > 0) & (affLegRightDamage > 0) then
do stuff
elseif ...
Thanks in advance.
A
Code: Select all
if (affLegLeftDamage > 0) & (affLegRightDamage > 0) then
do stuff
elseif ...
Code: Select all
if affLegLeftDamage > 0 and affLegLeftDamage > 0 then
do stuff
elseif ...
Yeah. Whenever you're dealing with booleans, Lua's and/or work as in any other language. Likewise, if you convert the result of any or/and expression to a boolean, you should get the same result as any or/and expression in another language. (The exception being the number 0, which is considered true in Lua).Meridian wrote:So, to make sure I have this conceptually, despite lua's odd treatment of and/or, this works out all right. That would be because each statement equates to either a true or a false argument. If the first argument boils down to false/nil, the entire condition is false. If the second boils down to false/nil, the entire condition is false. Otherwise, it returns whatever the second argument is, which in this case would be true, and the contingent block of code executes... right?
Code: Select all
something > something else
Code: Select all
something < something else
Code: Select all
something = 0