Tutorial:Cookbook/Chapter 1

Terminology is a fancy word that means "a bunch of terms and definitions". In programming in general, there are multiple terms used which all mean different things. I'll be explaining most of these terms in this tutorial, and in future tutorials they will be covered more.

Tasks

 * Learn definitions for various terms used in programming.
 * Basic understanding of how code is set up on Roblox.

Materials

 * None!

General Terminology
General Terminology refers to terms that are related to programming, but is not a term that is actually used in code.

Lua
Lua is a lightweight, robust, and simplistic programming language, and the programming language that all Roblox games use. All future tutorials will be in Lua. Lua is not very complicated compared to other languages, which is what makes Roblox a perfect tool to begin learning how to program.

C++
C++ is Roblox's internal language, which is integrated into Lua. It is impossible to program in C++ on Roblox directly, however C++ is integrated into Roblox in the form of instances and other data types.

Syntax
The term Syntax refers to the specific set of characters and symbols used in programming. For example, the curly brace ({{Keys|{}}) and other symbols play a vital role in programming.

Compiler
The compiler, also referred to as the program itself, is the machine that is running your code. Think of the compiler as the person that is reading your code and following the instructions.

Data types
In all programming languages, there are different types of information storage known as 'data types'. This is how data is expressed. There are 7 Lua data types and a couple of C++ specific types, as well as numerous different Roblox types that will be explained later. Get familiar with these!

boolean
A boolean is as simple as "yes", or "no". This or that. In programming it is expressed as 'true' or 'false'.

number/double
As the title states, a number value is simply a real number! It can be any number within -2147483647 and 2147483647 (or -2^31-1 and 2^31-1). Double is another name for number.

string
In programming, a string is a message made of text. This can be any message. An example would be "Hello, world!" (notice the quotes around the string; this will be explained later.)

function
See Functions/Methods

table
A table is a collection of data. Tables are very frequently used when more than one piece of data needs to be stored; for example, multiple numbers, instances, etc. This is more convenient than storing multiple different variables.

nil
nil is a fancy way of saying there is no data. nil is equivalent to nothing; there is no data. Nil is often used to clear a variable, giving it no value.

userdata
userdata is a variable that is none of the above. All C++ data types (see below) are userdatas as they are not native (part of) Lua.

C++ Data types
Unlike Lua data types, C++ data types are not built into Lua. They are added by Roblox, meaning that if you practice Lua elsewhere the following data types will not be present. Two undiscussed types include bool and double, as they are mentioned above.

float
A float is a type of number that is in Double-precision floating-point format format. You can read more about that at that link, but other than that it is very similar to a double.

integer/int
An integer/int is a type of number. However, the number must be a whole number, and cannot have decimals. For example, -3, -1, 5, 1000 are all integers. However, -5.5, 1.3333, 4.2, etc are not integers as they are not whole numbers.

void
void is a term that is very similar to nil, in the sense that it has no value. However, unlike nil, you cannot directly set a variable/property to void. Void is the return of a function, if the function returns nothing. If a function returns nothing, it returns "void". Void is essentially equal to nil in the sense that it has no value. In normal Lua, functions that don't return anything are stated to return nil.

Programming Terms
Programming Terms refer to terms that will be used in code. Although you might not directly type the word, you will be using them.

Variables
A variable is, simply put, a data point. It is data that is stored and can be used later. An example is asking the player a question and putting their answer into a variable where it can be used later. Variables, although they might seem lacking, are very important and will frequently appear in code.

In Lua there are 7 different types of variables. C++ contains additional types integrated into Lua. For more info, see Data types.

Condition
Programming is a set of directions to follow. At some points, the program might have to make a decision based on data provided, and from here the program can go multiple directions. This is known as a condition. A condition is a point in the code where the compiler must make a decision based on feedback from variables, properties, etc. This is represented in code by the keyword 'if'. We will talk about conditions in a future tutorial.

Property
A property is simply a variable that is tied to an instance. Instances will be explained upon in a later tutorial.

Event
An event is something that a function can connect to, and the function will be run when the event is fired. This will also be explained in a future tutorial.

Functions/Methods
A function, or method if tied to an instance, is a block of code that has its own code to run. When a function is "called", or told to run, it will run all the code inside of it. This is useful for code that repeats itself numerous times, as the code only needs to be typed once and placed into a function.