-
Notifications
You must be signed in to change notification settings - Fork 2
Basic Types
In TaffyScript, there are very few built in types. The ones that exist are as follows:
- Number (float)
- String
- 1-Dimensional Array
- 2-Dimensional Array
Number constants can be any numerical value with or without a decimal point (i.e. 13354 or 60.6). In addition, you can use the following two hex styles:
- Prefix with 0x - 0xFFFF00
- Prefix with ? - ?FFFF00
String constants can be any character in between single or double qoutes. There is no difference between the two. You can add a newline character by using \n.
In order to create an array, just assign a variable to an index like so:
array1[0] = "I'm in an array!";
array2[0, 0] = "I'm in a 2-Dimensional array!";
You can also create a 1D array in the following ways:
var arr = array_create(5)
var arr = [0, 1, 2, 3];
There is no built-in value for true and false, but there are keywords for it. The keyword true is equal to 1 and the keyword false is equal to 0. However, any numeric value that is greater than .5 evaluates to true, and vice versa for false. This seems like a strange method, and that's because it is. This just happens to be the method Gamemaker uses to determine truthiness, and so that's what TaffyScript uses as well, in an effort to not break backwords-compatability.