Reference

Comming soon

Key Features

Typed Variable
Type x,y,z;
var x,y=2;
var s=3;
var t(2);

var x1;   // x1==undefined;
int x2;   // x2==0
float x3;  // x3==0.0
string s;  // s==""
    
Class Definition
Along with JavaScript style class definition, KG-Script has "class" keyword to define classes much like C++ and JavaScript object definition.
        class AAA  : BBB {     //  define class "AAA", extending (inheriting) "BBB"
	        a:2                // property
	        ,b:"abc"           // property
	        ,h:prototype 20       // prototype "h"
	        ,AAA:function()    
               // prototype, If the function name is same as class name,
               // it is the a constructor. (automatically called)
	        {
	          super();    // call parent class' constructor.
	        }
	        ,c:function()       // prototype // === AAA.prototype.c=function()
	        {
	        }
	        ,d:prototype function()       // prototype // === AAA.prototype.d=function()
	        {
	        }
	        ,test:property function(){    // define property function  // setter/getter
                get{
                  println("A::test:getter: "+this.a);
                  return this.a;
                }
                set{
                  println("A::test:setter: value="+value);
                  this.a=value;
                }
                println("A::test:regular: "+v);    // Only if called directly
            }
  	        ,f:function() // function placeholder - it should define later in the form of "function AAA::f(){}"
        };

        function AAA::f()   // defining function "f". This is same as "AAA.prototype.f=function()"
        {
        }

        AAA a;   // all member variables will be copied. 
                 // (including parent classs' (all up to root), at the time of instanciation)
        var a=new AAA();  // JavaScript style instanciation.
    
Operator Oevrloading
    class A {
      a:0
      ,A:function(x){
        this.a=x;
      }
      ,"operator=":function(x)
      {
        println("operator="+x);
        this.a=x;
      }
      ,toString:function(){
        return "A:"+this.a;
      }
    };

    A a(3);   // a.a==3
    a=5;      // a.a==5
    
Named Parameter / Default Value
// named parameter function call:   
function func(a,b)
{
}
func( a->3, b->"aaa");

// default value
function func(a=1,b=2)
{
}

// If combined, it's powerful:
// Color class constructor is like this:
  
  Color:function(gray,red=255,green=255,blue=255,alpha=255,hue,saturation,value)

// So, you can use it like this:
  Color col2(hue->1,saturation->100,value->100);
  Color col1(red->50 ,blue->255, green->128, alpha->30);
Multi-dimention Array
var a=new[3][2][5]int(321);

a[2][1][3]=3;