Variables
Unlike C++, squirrel has multitype/dynamic variables, which means variables don't have an assigned type, but instead set their type to the value when they are set. This, unfortunately, increases the change of encountering an error if a wrong type is specified when a function is requesting another type. Local name < local n > is used to create local variables which can be used only in that block. Less than minus < <- > is used to create global variables, which, unlike local variables, can be used anywhere in the code.
Example
function n()
{
local e = "this small piece of text ";
local f = "is written in english and is shown 1 second after";
f <- e + f;
NewTimer( "i", 1000, 1 );
}
function i()
{
print( f );
}
{
local e = "this small piece of text ";
local f = "is written in english and is shown 1 second after";
f <- e + f;
NewTimer( "i", 1000, 1 );
}
function i()
{
print( f );
}