Author Topic: Unknown syntax error for eval work check  (Read 659 times)

When doing eval, it checks each word, then puts it in either green, grey, or red.

Somehow, it doesn't work right.

I do something like:
checkErrorEval("chicken(\"a\);"");

It tells the error of a, which, I am not sure what is going on.

Here is the code

   function checkErrorEval(%word)
   {
      $Eval::Word[%word] = 0;
      if(checkMalEval(%word))
         return %word = "\c7" @ %word @ "\c6";
      eval(%word SPC "$Eval::Word[\"" @ %word @ "\"] = 1;");
      if($Eval::Word[%word])
      {
         if(checkMalEval(%newWord))
            %newWord = "\c7" @ %word @ "\c6";
         else
            %newWord = "\c2" @ %word @ "\c6";
      }
      else
      {
         %newWord = "\c0" @ %word @ "\c6";
         $Eval::FailCount++;
      }
      return %newWord;
   }


This.. really doesn't seem like a good idea, just saying. If you input the following, it'll register the first word as a syntax error, then send "foo" to everyone 8 times with a final result of "syntax error".

messageAll('', "foo"); // albeit this is just a test

eval(%word SPC "$Eval::Word[\"" @ %word @ "\"] = 1;");

No need for escapes, just do this:

eval(%word SPC "$Eval::Word[%word]=1;");

EDIT: Thought you were using global variables for some reason other than getting it. If you aren't, just do this:

eval(%word SPC "%success[%word]=1;");
« Last Edit: January 02, 2014, 08:36:46 AM by Port »

Indeed this is a bad idea.

function null() { return 0x00; }

Every single last word in this statement will come out as a syntax error. The line as a whole, however, is entirely proper syntax and works.