When an error makes no sense: Difference between revisions
(This issue comes up a lot for me, hopefully it will help others who may be frustrated too) |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
Sometimes, the displayed error will not appear to be correct. The error parser will point you to a line of code which is correct, yet it will tell you that some strange error exists at that point. | Sometimes, the displayed error will not appear to be correct. The error parser will point you to a line of code which is correct, yet it will tell you that some strange error exists at that point. | ||
In this case, the problem usually lies '''beneath''' that point in the code. Usually the source of the error is actually a '''missing parenthesis, bracket, curly brace, etc.''' | In this case, the problem usually lies '''beneath''' that point in the code. | ||
Usually the source of the error is actually a '''missing parenthesis, bracket, curly brace, etc.''' | |||
Usually the error message says that it encountered a string where it expected code. | |||
'''Compatibility:''' | '''Compatibility:''' | ||
This only applies to | This only applies to [[SQF Syntax]] scripts, not [[SQS Syntax|SQS]] scripts. | ||
'''Example:''' | '''Example:''' | ||
< | <sqf> | ||
for "_i" from 0 to 1 do | |||
{ | { | ||
_str = format["mystring"; | _str = format ["mystring", _i; | ||
};</ | }; | ||
In this example, the error will be shown to originate just to the left of the word "do". However, the error is actually caused by a line in the code beneath the do statement | </sqf> | ||
In this example, the error will be shown to originate just to the left of the word "do". | |||
However, the error is actually caused by a line in the code beneath the do statement | |||
(such an error would be difficult to spot if it were many more lines down in the code). | |||
[[Category:Common Scripting Errors]] | [[Category:Common Scripting Errors]] |
Latest revision as of 23:26, 31 August 2025
Sometimes, the displayed error will not appear to be correct. The error parser will point you to a line of code which is correct, yet it will tell you that some strange error exists at that point.
In this case, the problem usually lies beneath that point in the code. Usually the source of the error is actually a missing parenthesis, bracket, curly brace, etc. Usually the error message says that it encountered a string where it expected code.
Compatibility:
This only applies to SQF Syntax scripts, not SQS scripts.
Example:
In this example, the error will be shown to originate just to the left of the word "do". However, the error is actually caused by a line in the code beneath the do statement (such an error would be difficult to spot if it were many more lines down in the code).