"Fossies" - the Fresh Open Source Software Archive

Member "cloc-1.86/tests/inputs/squirrel_table.nut" (19 May 2020, 544 Bytes) of package /linux/privat/cloc-1.86.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Squirrel source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 /*
    2  http://www.squirrel-lang.org/
    3 */
    4 local table = {
    5     a = "10"
    6     subtable = {
    7         array = [1,2,3]
    8     },
    9     [10 + 123] = "expression index"
   10 }
   11  
   12 local array=[ 1, 2, 3, { a = 10, b = "string" } ];
   13  
   14 foreach (i,val in array)
   15 {
   16     ::print("the type of val is"+typeof val);
   17 }
   18  
   19 /////////////////////////////////////////////
   20  
   21 class Entity
   22 {   
   23     constructor(etype,entityname)
   24     {
   25         name = entityname;
   26         type = etype;
   27     }
   28                                     
   29     x = 0;
   30     y = 0;
   31     z = 0;
   32     name = null;
   33     type = null;
   34 }
   35  
   36 function Entity::MoveTo(newx,newy,newz)
   37 {
   38     x = newx;
   39     y = newy;
   40     z = newz;
   41 }