Squirrel 是一个高水平,面向对象的编程语言,是为一定大小,内存带宽和有实时需求应用(比如视频游戏)而设计的一款轻量级脚本语言。

Squirrel修改SQL(Squirrel面向对象轻量级脚本语言)(1)

Squirrel 主要特性:

Squirrel 灵感来源于 Python,JavaScript 和 Java。

  • MS Visual C 6.0,7.0,7.1,8.0,9.0 and 10.0(x86 & x64)

  • MinGW gcc 3.2 (mingw special 20020817-1)

  • Cygwin gcc 3.2

  • Linux gcc 3.x

  • Linux gcc 4.x

  • Illumos gcc 4.x

  • XCode 4

  • 示例

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

    微信订阅号:开源派 (opensourcepie)

    开源派官网:osp.io 作者:叶秀兰

    ,