Articles Archive
Director Forums
Director Wiki
Job Board
Search
 
 Director Online WikiMain Page | About | Help | FAQ | Special pages | Log in | Printable version | Disclaimers

Type

From Director Online Wiki

A variable has two components: a type and a value. The type tells Lingo how the value should be interpreted. Lingo is loosely typed, meaning that you need not care about type for the most part. For example:

   thisIsaString = "1"
   thisIsAnInteger = 1
   thisIsaFloat = 1.0

All of the above values are numerically identical, but they all have different types and so are stored differently internally. They are also handled in very slightly different ways.

For example, if you divide one integer by another integer and the result is not an integer, Lingo will automatically round the result to the nearest integer. This is no use if an accurate result is required. To obtain an accurate result at least one of the values in the equation must be of the floating point type. Fortunately this is very easily achieved, as the following example shows:

   incorrectResult = 4 / 3
   correctResult = 1.0 * 4 / 3
   put incorrectResult
   -- 1
   put correctResult
   -- 1.3333

You can find the type of a variable using the ilk function, or one of the predicate functions.

The types available in Lingo are

Special:

  • symbol
  • void

Lists

  • linearlist
  • proplist

Numbers

  • float
  • integer
  • string

Objects:

  • castlib
  • color
  • date
  • instance
  • media
  • member
  • object
  • picture
  • point
  • rect
  • script
  • sound
  • sprite
  • window
  • xtra

3D Objects:

  • box
  • camera
  • collisiondata
  • cylinder
  • group
  • mesh
  • model
  • modelResource
  • motion
  • particle
  • plane
  • renderer
  • shader
  • sphere
  • texture
  • transform
  • vector

Retrieved from "http://www.director-online.com/dougwiki/index.php/Type"

This page has been accessed 1060 times. This page was last modified 18:46, 9 Apr 2005.