Languages

Build-In Support

EnlighterJS v2.11.1 is out including new Languages & Themes. View the Changelog

Squirrel

Select Theme

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor static num = 0; invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet.

// Squirrel support single-line comments
# that use the pound/octothorpe and double-slashes
/*
As well as
multi-line
comments
*/

// Sample code below from http://www.squirrel-lang.org/doc/squirrel3.html

local a = 123; //decimal
local b = 0x0012; //hexadecimal
local c = 075; //octal
local d = 'w'; //char code

// Floats
local a=1.0;
local b=0.234;
local c=1.521E-21
local d=9891.214e32

// Array
local a=["I","am","an","array"];

function testy(arg)
{
    local a=10;
    print(a);
    return arg;
}			
	
while(1)
{
    if(a<0) break;
    a-=1;
}

local a=0;
do
{
    print(a+"\n");
    a+=1;
} while(a>100)	

local a=[10,23,33,41,589,56]
foreach(val in a)
    print("value="+val+"\n");

// SOURCE: http://www.squirrel-lang.org/
local table = {
	a = "10"
	subtable = {
		array = [1,2,3]
	},
	[10 + 123] = "expression index"
}

local array=[ 1, 2, 3, { a = 10, b = "string" } ];

foreach (i,val in array)
{
	::print("the type of val is"+typeof val);
}

/////////////////////////////////////////////

class Entity
{
	constructor(etype,entityname)
	{
		name = entityname;
		type = etype;
	}

	x = 0;
	y = 0;
	z = 0;
	name = null;
	type = null;
}

function Entity::MoveTo(newx,newy,newz)
{
	x = newx;
	y = newy;
	z = newz;
}

class Player extends Entity {
	constructor(entityname)
	{
		base.constructor("Player",entityname)
	}
	function DoDomething()
	{
		::print("something");
	}

}

local newplayer = Player("da playar");

newplayer.MoveTo(100,200,300);
print(newplayer.x + 1);