View Single Post
  #1  
Old 05-18-2005, 12:59 AM
Rick Rick is offline
PipBoy Extraordinaire!
Rick's Avatar
Join Date: Jul 2004
Location: Long Beach, California.
Posts: 831
Rick is on a distinguished road
Lightbulb GScript2: Possible bug/optimization problem

HTML Code:
if (function() == true)
{
}
It will not execute the condition at all, if there is no code within the braces. Now, this could be desired behavior, but what if function() is supposed to do something that modifies the enviornment?

The easiest way to observe this problem:

HTML Code:
function sendrcamessage()
{
  sendtorc("if ...");
  return true;
}

function onCreated()
{
  if (sendrcamessage() == true)
  {
  }
}
I came across this problem when quickly prototyping some new code.
Reply With Quote