Author Topic: Check if a Executed file has syntax errors *SOLVED*  (Read 500 times)

how would I check if an executed file had syntax errors?
Exec("config/Test.cs");
« Last Edit: January 28, 2012, 08:06:48 PM by swollow »

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.

Code: [Select]
if(!compile("scriptname.cs")) warn("Contains syntax errors!")

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

Are there any other uses for the compile function?

Are there any other uses for the compile function?
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.