sconemad

technology, scones, nonsense

Loading...

Profiles

Twitter

GitHub

Launchpad

Subscribe to my RSS Feed

Admin

Sconescript

Sconescript is an object orientated scripting language built into sconeserver.

Its syntax is modeled on C and JavaScript, so it should look very familiar if you have experience in either of these languages. Program control syntax such as if, else, for, while, break and continue and return are identical to C. The keywords var, ref and const are used to declare variables, references and constants. Literal initializers are the same as in JavaScript (and, therefore, JSON), which can be very useful.

Standard methods

defined ( value : Any )
Is the value defined?

Constructors

SconeScript has the following built-in object types, which can be constructed explicitly using the following constructor functions. In addition, some object types are constructed automatically, for example a String type is constructed whenever a "quoted string" is encountered in SconeScript code.

String ( value : Any )
Construct a String object, initializing with the specified value (which is casted to a String type if required).
Int ( value : Any )
Construct an Int object, initializing with the specified value (which is casted to an Int type if required).
Real ( value : Any )
Construct a Real (floating point number) object, initializing with the specified value (which is casted to a Real type if required).
Error ( value : Any )
Construct an object representing an error, initializing with the specified value.
Version ( major : Int, minor : Int, sub : Int, extra : String )
Construct a VersionTag object, using the specified major, minor and sub version numbers, plus an optional extra tag.
Date ( epoch_seconds : Int, local : Bool )
Construct a Date object for the specified epoch_seconds value (number of seconds since the UNIX epoch). The parameter local indicates whether the date is in the local timezone or UTC.
Time ( seconds : Int )
Construct a Time object specifying the number of seconds.
Uri ( value : String )
Construct a Uri (Uniform Resource Indicator) object from a string.
MimeType ( value : String )
Construct a MimeType object from a string.

Statement groups

{ 
  statement1; 
  statement2;
  statement3;
}

Declarations

var name = initialiser;
const name = initialiser;
ref name = initialiser;
constref name = initialiser;

Program flow

return value;
break;
continue;

Conditional

if ( condition-expr )
  statement-when-true;
else
statement-when-false;

Loops

while ( condition )
  statement;

for ( initialiser ; condition ; increment ) 
  statement;

Subroutines

sub subname( argument-list )
{
  statements
}
Updated on 2013-11-04 14:15:31 +0000 | Requested on 2019-07-20 00:42:52 +0000