Template:Nasal Constructor inline

From FlightGear wiki
Jump to navigation Jump to search
 # constructor, for making new objects
 new: func( arg... ) {
  # creates a temporary object that inherits from myClass
  # what is obj here, will later on be 'me' in the actual object
  var obj = { parents:[  myClass   ] };

  # do any other object setup here, such as for example
  obj.message = "Hello World";
  print("Creating new object/instance of type/template:myClass");    

  # return the object to the caller
  return obj;