This project is read-only.

Getting Started

A script in AddyScript is any sequence of statements. Even an empty file is a valid script. A statement is anything from an import directive to a try-catch block. There is no special order in which you should arrange your statements. For example, you can assign a variable, then declare a class and after that call a function. Some statements embed others. However, there is a subset of statements that are not embeddable. These include import directives, class declarations and function declarations. They can only be used at the root level (i.e. out of any block). Below are some examples of scripts:

A simple "Hello World"

println('Hello World!');

The sum and averrage of n numbers

n = (int) readln('How many numbers? ');  
sum = 0;  
for (i = 0; i < n; ++i)  
    print('Item number {0}: ', i + 1);  
    sum += (float) readln();  
println('The sum is {0}', sum);  
println('The averrage is {0}', sum / n);

A function to say "Hello"

function hello(name)  
    println('Hello ' + name);  
    if (name == 'roger')
        println('Have you been a football player?');   

names = ['john', 'mike', 'bill', 'david', 'mark', 'roger'];  

// Hello to anyone:  
foreach (name in names)  

// Another way to do the same stuff:  

// Or without declaring the 'hello' function at all:  
names.each(function (x)  
    println('Hello ' + x);  
    if (x != 'bill') return;  
    println('Have you been a CEO somewhere?');  

Well, now you can try your own.

Last edited Feb 14, 2012 at 1:32 PM by addy, version 5


addy Apr 4, 2012 at 2:39 PM 
Yes of course you can add a reference to (not a single class but) a whole assembly from a script. To achieve this, you must add the target assembly to the "References" property of your "ScriptContext" (that is one of the objects you use to initialize the scripting engine before invoking it). Any public class of that assembly will then be made accessible to your script. In the next release of AddyScript, there will be a mean for managing references from the script itself (as well as a mean of using .Net types without having to type their fully qualified names).
AddyScript accesses to any public member of a .Net class. I think it's more natural to do so.
The small graphical editor is shipped with a help manual in the CHM format. This one includes a syntax reference and provides a better description of the language than this single page (however, the page will get more content in the time).

kroltan Apr 1, 2012 at 10:31 PM 
Hey, how can I reference a .NET class from a addy? Do I just use it normally (Class.DoStuff())? If yes, how can I limit what AddyScript has access to?
Also, is there a syntax reference?