S2:Defined

A property or function needs a definition like in a dictionary so that S2 knows what to do with them.

If a property is defined in a Layout Layer, it will be saved to a User Layer when set using the wizard.

If you have a definition of a function in a layer and you try to put another definition of the same function into the layer, only one of them will be used and the other will be forgotten. Make sure that you merge your functions if you want parts of each to be included in your final product.

= Property = The following is a definition of a property: property string text_view_recent {                             # we're defining a property # it is a string # we're calling it "text_view_recent" des      = "Text used to link to the 'Recent Entries' view"; # this is a description of the property maxlength = 20;                                              # this is the maximum length of the value of the property size     = 15;                                               # this is the size of the text input field in the wizard example  = "Recent Posts";                                   # this is an example of what a value could be }

= Function = The following is a definition of a function: function MessagePage::view_title : string { # we're in the MessagePage Class # the function name is "view_title" # we're going to return a string return $.title;                            # we're going to return the member variable called "title" }

= Class = The following is a definition of a class: class Date "Represents a date." { # we're defining a Class # we're calling it "Date" # we're also providing an explanation about what the function does var int day  "Day; 1-31.";      # this is an int called "day" with an explanation var int month "Month; 1-12.";   # this is an int called "month" with an explanation var int year "Year; 4 digits."; # this is an int called "year" with an explanation function builtin compare(Date d) : int # this is a builtin function called "compare" # it receives a Date object called "d" # it returns an int "Compare two dates.";                 # it also has an explanation function builtin date_format : string # this function does not receive anything "Returns date formatted as normal."; function builtin date_format(string fmt) : string "Returns date formatted as indicated by $fmt."; function builtin day_of_week : int "Returns the day of the week this date falls on."; }