Blockland Forums > Modification Help
Check if a Executed file has syntax errors *SOLVED*
Swollow:
how would I check if an executed file had syntax errors?
Exec("config/Test.cs");
Nexus:
What I have seen done in the past is where the function to execute a file will add a line at the beginning that says $execsuccess = 1; or something and then see if $execsuccess gets set to true, which means there was a syntax error and the file could not execute.
CityRPG:
--- Code: ---if(!compile("scriptname.cs")) warn("Contains syntax errors!")
--- End code ---
compile( fileName )
Purpose
Use the compile function to pre-compile a script file without executing the contents.
Syntax
fileName – A path to the script to compile.
Returns
Returns 1 if the script compiled without errors and 0 if the file did not compile
correctly or if the path is wrong. Also, ff the path is invalid, an error will print to
the console
Lugnut:
Are there any other uses for the compile function?
CityRPG:
--- Quote from: Lugnut1206 on January 26, 2012, 07:45:56 PM ---Are there any other uses for the compile function?
--- End quote ---
No. In pre-retail Blockland, compile's primary function was to turn scripts into encrypted DSO file types. This is what The Better Mod did to keep their hijinks on the low-down for a long time.
As a security measure, compile does not create DSO files in Blockland to prevent players from making malicious add-ons Badspot cannot hold them accountable for.