28.03.2005
Lingo Script for C programmers
Since I’ve changed my job recently I’ve been pushed to learn some new stuff I haven’t used ever before. One among them is dealing with Macromedia Director and it’s Lingo Script - language used for scripting in Director.
As a programmer with strong background in C like languages (C, Java, PHP …) I found my self completely frustrated with Lingo script syntax. I am sure other “real” programmers like me will be frustrated too, so I decided to write down few syntax guidelines about lingo. Hopefully This will be helpfull for someone :)
Lingo Script - few syntax guidlines
- Setting variables:
set myVariable to 10
or
myVariable = 10
- Variables max 255 char, it should begin with letters or undersscore
- Variables ARE NOT case sensitiv (so, foo == FOO)
- Variable types:
Integer
Boolean (true, false, 1,0)
Float
String
Symbol (#hello,#x1 …)
List
Object
- Operators:
Arithmetic: +,-,*,/,mod
Comparasion: ,=,=,
Logic: AND,OR,NOT
Concatenation: && or & (&& operator put space between strings, & not)
Handlers and Functions:
on Foo arg1,arg2, … ,argn
statement(s)
end
Function is handler which return value
- if construct in lingo is:
if integerExpression then
statement(s)
end if
or
if integerExpression then
statement(s)
else if integerExpression2 then
statement(s)
..
else
statement(s)
endif
- Loops:
repeat while integerExpression
statement(s)
end repeat
repeat with i = intExpression to largerIntExpression
statements
end repeat
repeat with i = intExpression down to smallerIntExpression
statements
end repeat
repeat with variable in aList
statements
end repeat
- Inside of loops:
for exit (aka break) use :
exit repeat
for next iteration (aka continue):
next repeat
