Squirrel is an actively used programming language created in 2003. Squirrel is a high level imperative, object-oriented programming language, designed to be a light-weight scripting language that fits in the size, memory bandwidth, and real-time requirements of applications like video games and hardware such as Electric Imp. MirthKit, a simple toolkit for making and distributing open source, cross-platform 2D games, uses Squirrel for its platform. It is used extensively by Code::Blocks for scripting and was also used in Final Fantasy Crystal Chronicles: My Life as a King. Read more on Wikipedia...

16Years Old 1,128Users 2Jobs

Example code from the Hello World Collection:

#!/usr/bin/squirrelsh
// Hello world in Squirrel
printl("Hello, world!");

Example code from Linguist:

//example from http://www.squirrel-lang.org/#documentation

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);	

Example code from Wikipedia:

class BaseVector {
    constructor(...)
    {
      if(vargv.len() >= 3) {
        x = vargv[0];
        y = vargv[1];
        z = vargv[2];
      }
    }
    x = 0;
    y = 0;
    z = 0;
  }

  class Vector3 extends BaseVector {
    function _add(other)
    {
      if(other instanceof ::Vector3)
        return ::Vector3(x+other.x,y+other.y,z+other.z);
      else
        throw "wrong parameter";
    }
    function Print()
    {
      ::print(x+","+y+","+z+"\n");
    }
  }

  local v0 = Vector3(1,2,3)
  local v1 = Vector3(11,12,13)
  local v2 = v0 + v1;
  v2.Print();

Trending Repos

repo stars description

Last updated December 4th, 2019

Edit Squirrel